Please help with the logic!
Not able to figure out the logic
For making the maximum number possible what you have to is to place the highest digit on 0th location and then next highest on 1st and so on… For this just check 0th index, if it’s not the highest among the digits just swap with the index where the highest digit is placed and move on to 1st index …And in this way in ‘k’ swaps, you will make the maximum number possible in k swaps.