Blind 75 Stack Questions
1 problem · Free practice
Valid Parentheses is a small problem that tests a useful invariant: the stack contains the opening brackets that still need a match. A closing bracket must pair with the most recent unmatched opening bracket. Counting bracket types alone is insufficient because the order of nesting matters.
Practice stack
What to focus on
- Reject a closing bracket when the stack is empty.
- Match each closing bracket against the stack top, not any earlier opening bracket.
- After the scan, require the stack to be empty.