Valid Brackets
mediumDescription & examples
Decide whether every opening bracket has a matching closing bracket of the same kind, in the correct nesting order. Return a boolean. An empty string is valid.
Examples
text = "{[()]}" → true
text = "([)]" → false
text = "" → true
Constraints
0 ≤ length ≤ 10,000. Only (, ), [, ], {, and } occur.
Guided help
Take one nudge at a time. The full walkthrough opens only after you choose Show Solution.
