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.
Had same problem to start with and I was disappointed as well but if you really think about it the fun of this exercise is to fix the performance issue and has nothing to do with language - PS I read someone replying to your comment showing off with Node.js (LOL it's all I have to say)
Anyway have a second look at your code and try avoiding operations like updating the array and indexOf. These computations are the real performance killer. BTW my solution is in Scala if you want to have a look at it let me know
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 →
Had same problem to start with and I was disappointed as well but if you really think about it the fun of this exercise is to fix the performance issue and has nothing to do with language - PS I read someone replying to your comment showing off with Node.js (LOL it's all I have to say)
Anyway have a second look at your code and try avoiding operations like updating the array and indexOf. These computations are the real performance killer. BTW my solution is in Scala if you want to have a look at it let me know