Unlock test case i exceeded time limit

https://codeshare.io/24Lowd change the code accordingly for at most k swaps but still gettting tle!!!

Simpy sort the input and then check iteratively from starting till you get the k numbers that are differing in their position with the original input. Keep the elements of the sorted sequence till this point and the original sequence after that and merge all those.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.