Easy · Stack
Valid Parentheses
You are given a string, s, made only of the brackets ( ) [ ] { }. Return true if every opening bracket is closed by the same kind of bracket, in the right order. Otherwise return false.
- The bracket opened last must be the first to close.
- A closing bracket with nothing open makes it invalid.
- Anything still open at the end makes it invalid.
s = "([]{})" → true
s = "([)]" → false (closed in the wrong order)Record your take