Problem 2948 · Medium

Make Lexicographically Smallest Array by Swapping Elements

Rearrange an array into the smallest possible order using swaps allowed only between values within a given limit. The visual groups the values into connected blocks and sorts each block in place.

Open the interactive visualisation