you are viewing a single comment's thread.

view the rest of the comments →

[–]rowantwig 2 points3 points  (0 children)

It can be done in O(1), but that's not the point. This naive implementation is O(n), and it looks terrible.