Swaps Under Lexicographically Smallest Improving Pair

Company: Uber

Difficulty: medium