Unlock Problem Help!

i have some ques
1> we have to use map or unodered map
2> we have to make mapping like num->pos
or its reverse
3> traversing from num =n to 1 we can find the best pos for the ith num by n- num than we can easily assign a best pos to the current num but how we will came to know that which num is earlier linked with that pos and to whom to swap with,

plz ans it in detail …

@akb.tech17 It totally depends upon your approach whether to map or unordered map, i can’t tell you this without knowing your approach. I am not getting you approach.
One easy way can be storing it in a string and then doing the swaps with largest possible digit

You have to iterate from largest numeber i.e. n till 1 and have to place them at there best postion.
If they are already at their best postion then do nothing else increment the count
when count == k then break the return the permutation.

The reason behind iterating from n to 1 is, that we want the largest permutation but limit is max k swaps, for these swaps we will try to do those swaps by which the number then formed is the largest possible.

I hope you got it what i am saying.