Stack • Beginner • 15 min
Valid Parentheses
How to notice that each closing bracket must match the most recent opening one and why that calls for a stack.
Practice problems with walkthroughs, hints, and solutions.
Filter by type or level
Stack • Beginner • 15 min
How to notice that each closing bracket must match the most recent opening one and why that calls for a stack.
Stack • Intermediate • 15 min
How to keep the minimum updated in O(1) with a simple helper structure instead of scanning the whole stack.
Stack • Intermediate • 15 min
How to compose two stacks to simulate a queue and understand why lazy transfer keeps the amortized cost low.