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.
Step to the kth next arrangement of the digits, then count the adjacent swaps needed by moving each digit forward once.