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. 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)
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
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. 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)