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.
I wrote a smiliar solution (also in Python) but it didn't come anywhere close to running in time. My solution, like yours, ran in O(N^2) time which is too slow given that there are 100,000 elements.
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 →
I wrote a smiliar solution (also in Python) but it didn't come anywhere close to running in time. My solution, like yours, ran in O(N^2) time which is too slow given that there are 100,000 elements.