i am not getting the appropriate answer
please help me
Minimum swaps to sort the array
hi @abhinavssr2003_eab0717682969e5c,
refer here --> https://www.geeksforgeeks.org/minimum-number-swaps-required-sort-array/
still didn’t get it…like tha last step
@abhinavssr2003_eab0717682969e5c,
It first counts the no of elements in a cycle the it keeps adding cycle-1 (no of swaps) in the ans if cycle > 0 else it will add -1 to ans.
please do a dry run yourself you’ll get it
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.