Queues
Queue problems are less common but it is still a data structure that is worth understanding well
Last updated
Queue problems are less common but it is still a data structure that is worth understanding well
Last updated
Enqueue/offer:
Dequeue/poll:
Front:
Back:
isEmpty:
Built in data structure like []
in Python use , not
Check if can assume data structure is optimal
To optimize for Python, use from collections import deque
instead to popleft()
Empty queues
Queue with one item
Queue with two items
Pop the queue and push back onto itself to bring the last element to the front