← All problems

Valid Parentheses

Easy stringsstacks LeetCode ↗
Determine if a bracket string is valid (properly closed and nested).

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n), Space O(n)

Common pitfalls

  • Only counting brackets (nesting matters)
  • Forgetting the final empty check

Your solution

Log in to save your code and track progress.