The output of the example is coming correct but when I submit it all test cases are showing wrong answer.
This is the code I have written.
Testcase showing wrong answer
for inputs where less than k swaps are possible your code is not running at all