Not working if no. of swap is 0

i have solved this ques but this does not work if I put no. of swaps is 0.
Although it is out of ques but this can be a case as same ques i saw in codeforces

What you can do is make a test case, and suggest to team by mailing it to [email protected] .

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.