Problem 1850 · Medium

Minimum Adjacent Swaps to Reach the Kth Smallest Number

Step to the kth next arrangement of the digits, then count the adjacent swaps needed by moving each digit forward once.

Open the interactive visualisation