LeetCode ยท Queue
Queue Problem Set
FIFO problems โ level-order traversal, shortest paths on unweighted graphs, multi-source spread, ring buffers, and queue-powered scheduling.
Concept page: Queue
| Difficulty | Pattern | Problem | Key Insight |
|---|---|---|---|
| Medium | bfs | LC 102 ยท Binary Tree Level Order Traversal | Snapshot queue.size() at each level so children join the next layer, not the current one. |
| Medium | bfs | LC 200 ยท Number of Islands | Flood-fill each new island with BFS so every land cell is counted exactly once. |
| Medium | multi-source | LC 994 ยท Rotting Oranges | Start BFS from all rotten oranges simultaneously โ each level is one minute of spread. |
| Medium | design | LC 622 ยท Design Circular Queue | Use a fixed array plus head and size to distinguish full from empty cleanly. |
| Medium | greedy+queue | LC 621 ยท Task Scheduler | A cooldown queue tracks when tasks become available again while a heap picks the next best task. |
| Hard | monotonic | LC 239 ยท Sliding Window Maximum | A monotonic deque keeps the current maximum at the front and evicts useless indices from the back. |