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's same with sorting. In algorith page it says :"Firstly, identify the longest suffix that is non-increasing (i.e. weakly decreasing)."
And that's the part helped me to see my algorithm's mistake. I was just finding the pair to swap, then sorting second part. It was giving correct answers for only around 96 percent of words, then looking for alternative permutations was causing timeouts.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bigger is Greater
You are viewing a single comment's thread. Return to all comments →
It's same with sorting. In algorith page it says :"Firstly, identify the longest suffix that is non-increasing (i.e. weakly decreasing)." And that's the part helped me to see my algorithm's mistake. I was just finding the pair to swap, then sorting second part. It was giving correct answers for only around 96 percent of words, then looking for alternative permutations was causing timeouts.