Valid Parentheses — Stack
Decide whether a string of opening and closing bracket symbols is properly nested, with each opener matched in the right order.
Stack · Easy
The problem
Given a string of only round, square and curly brackets, say whether every opener is closed by the right kind, in the right order.
What to return
- Return true if every opener is closed by the same kind of bracket, in the right order, otherwise false.
- An empty string is valid.
Constraints
- 0 ≤ len(s) ≤ 24
- s contains only the characters ( ) [ ] { }
Example
- Input
s = "()[]{}"- Output
true