SERIES
Stack
Teach stack-based patterns — LIFO structure for tracking "last seen", monotonic stacks, expression evaluation.
In this seriesNEWSLETTER
01
Valid Parentheses: LIFO is exactly what matching brackets need
The stack isn't a clever trick here — it's the natural data structure for this problem. You need the most recently opened bracket to match the next closing one. That's LIFO. The only question is when and how to pop.Jun 13, 2026 · 10 min read · #00021
02
Evaluate Reverse Polish Notation: stack as the implicit expression tree
RPN is postfix notation — operators come after operands. The stack holds the pending operands. Each operator pops two, applies the operation, and pushes the result. By the end, exactly one value remains. The stack is the expression tree collapsed into one linear structure.Jun 13, 2026 · 10 min read · #00022
Occasional notes on what I'm building
Get an email when I publish a new post — engineering write-ups, no spam. Unsubscribe anytime.