Core Patterns
Stacks & Monotonic Stacks
Last in, first out: match brackets, evaluate expressions, carry extra state, and use monotonic stacks to find the next greater or smaller element in O(n).
0 of 3 lessons complete, 0 of 7 problems solved
Coursework
35 min
Up next
Stacks: Last In, First Out
Use a Python list as a stack and spot the nesting problems it solves.
10 min
Stacks That Carry State
Push pairs to remember a running minimum, and evaluate expressions with a stack.
11 min
Monotonic Stacks: Next Greater Element
Answer 'next greater / smaller' for every element in one O(n) pass.
14 min
Practice ladder
Start with the first problem, then work toward the harder variations. Run examples before submitting against all tests.
Next unit: Binary Search