We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
A stack is the right answer whenever the most recently seen item is the one you need next: matching parentheses, evaluating postfix expressions, or walking a browser history. The tell is nesting or reversal in the problem statement. It is also the substrate for the monotonic-stack pattern, which is where stacks get genuinely hard.
Balanced brackets, nested structures, undo/back semantics, or expression evaluation.
12 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.