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.
Besides the fact that string comparison is obviously linear, you would still have to have a fallback to a O(n) algorithm. Since for an input tending to infinity you would need to use it, the whole algorithm would still be O(n).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
Besides the fact that string comparison is obviously linear, you would still have to have a fallback to a O(n) algorithm. Since for an input tending to infinity you would need to use it, the whole algorithm would still be O(n).