You are viewing a single comment's thread. Return to all comments →
You don't need to alalyze and swap the last element. Run your loop from 0 to less arr.length-1. It passes all the tests.
Minimum Swaps 2
You are viewing a single comment's thread. Return to all comments →
You don't need to alalyze and swap the last element. Run your loop from 0 to less arr.length-1. It passes all the tests.