We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It works, but technically you're not supposed to modify the loop variable within the body of a for loop because it's a bad programming practice. You should have used a while loop to avoid that.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Swaps 2
You are viewing a single comment's thread. Return to all comments →
It works, but technically you're not supposed to modify the loop variable within the body of a for loop because it's a bad programming practice. You should have used a while loop to avoid that.