You are viewing a single comment's thread. Return to all comments →
Hey, I like your solution. A recommendation for the future is if you want to pop the first element, you should use a deque.
arr.pop(0) is O(N) while the deque version arr.popleft() is O(1)