Framework Thinking - Neetcode 150 - Valid Parentheses

Here is the problem for Valid Parentheses.

1. Understand the problem

Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’, and ‘]’, determine if the input string is valid. A string is valid if:

  1. Open brackets are closed by the same type of brackets.

  2. Open brackets are closed in the correct order.

2. Clarify requirements

  • Only contains ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’, ‘]’.

  • Empty string “” → valid.

  • Can there be other characters? → No.

  • Is “)(“ valid? → No, order matters.

  • Expected time/space complexity? → O(n) time, O(n) space is typical.

3. Work through examples

Input Output Reason
"()" true Simple pair
"()[]{}" true Multiple valid pairs
"(]" false Mismatched types
"([)]" false Wrong order
"{[]}" true Nested valid
November 9, 2025