DSA learning path
Stacks & Queues
LIFO/FIFO, monotonic stacks and deque patterns.
Problems in this path
- Valid BracketsOpen
Easy · Stack - Evaluate Reverse Polish NotationOpen
Medium · Stack - Next Greater ElementOpen
Medium · Monotonic Stack - Sliding Window MaximumOpen
Hard · Monotonic Deque - Days Until a Warmer TemperatureOpen
Medium · Monotonic Stack - Simplify a Unix PathOpen
Medium · Stack Normalisation - Decode a Bracketed StringOpen
Medium · Nested Stack Frames - Largest Histogram RectangleOpen
Hard · Monotonic Increasing Stack - Resolve Asteroid CollisionsOpen
Medium · Collision Stack - Simulate a Queue with Two StacksOpen
Easy · Amortised Two Stacks
Read first
Stacks
Last in, first out. How a stack works, how to build one on top of an array, and the problems it solves, from matching brackets to undo.
11 min readQueues and Deques
First in, first out. How a queue works, why a circular buffer makes both ends O(1), and where queues show up, from schedulers to breadth-first search.
13 min read