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.
Even though there is the amortized cost of dealing with collisions, it is still O(1). That's because you drop coefficients in big-O notation. So the hashing approach can give you a runtime of O(n) on this problem.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
Even though there is the amortized cost of dealing with collisions, it is still O(1). That's because you drop coefficients in big-O notation. So the hashing approach can give you a runtime of O(n) on this problem.