Minimium swaps to sort the array


i had written this code and it worked well for some of the input values i had taken, but here it certifies only two test cases and fails the other two. Kindly elaborate rest of the two test cases so that i can makes the changes in the program code respectively.

hi @mvermav19
refer this -->

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.