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.
True. However, it becomes an elegant solution if we use collections.dequeue instead of list. Double ended queues have a popleft method, which is an O(1) operation:
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
True. However, it becomes an elegant solution if we use collections.dequeue instead of list. Double ended queues have a popleft method, which is an O(1) operation:
More info: https://wiki.python.org/moin/TimeComplexity#collections.deque https://docs.python.org/3/library/collections.html#collections.deque