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 spent days banging my head on my desk a year ago trying to solve this, and finally gave up. Tonight I decided to try and tackle it again, and kept getting 3 swaps for this same test case, and I couldn't understand what I was doing wrong because I was returning a perfectly sorted array. Then I read your comment. Thank you!!!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Merge Sort: Counting Inversions
You are viewing a single comment's thread. Return to all comments →
I spent days banging my head on my desk a year ago trying to solve this, and finally gave up. Tonight I decided to try and tackle it again, and kept getting 3 swaps for this same test case, and I couldn't understand what I was doing wrong because I was returning a perfectly sorted array. Then I read your comment. Thank you!!!