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 may have constant time complexity, but you're doing it N times. If calling len takes a second and N is a million, then that's 999 999 seconds you've wasted. Obviously, calling len won't take a second, but if all you're looking at is the fact that it takes constant time, you won't know that.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Minion Game
You are viewing a single comment's thread. Return to all comments →
It may have constant time complexity, but you're doing it N times. If calling
len
takes a second and N is a million, then that's 999 999 seconds you've wasted. Obviously, callinglen
won't take a second, but if all you're looking at is the fact that it takes constant time, you won't know that.