Stacks
Know
Last in, first out. The discipline matches nesting, backtracking, undo, and expression evaluation because the most recent unfinished thing is always the one to resolve.
Apply
Reach for a stack when the problem involves matching pairs or reversing recent work.
Watch out
Indexing into a stack, which discards the guarantee that made it appropriate.
Study move
Use a stack to validate nested brackets and state both failure conditions.
