• + 0 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. https://docs.python.org/3/library/collections.html#collections.deque

    arr.pop(0) is O(N) while the deque version arr.popleft() is O(1)