1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number
Description
**Input:** num = "5489355142", k = 4
**Output:** 2
**Explanation:** The 4th smallest wonderful number is "5489355421". To get this number:
- Swap index 7 with index 8: "5489355142" -> "5489355412"
- Swap index 8 with index 9: "5489355412" -> "5489355421"ac
Previous1849. Splitting a String Into Descending Consecutive ValuesNext1851. Minimum Interval to Include Each Query
Last updated