algorithm · Level 1 · 15 min
Given a string s containing only the characters (, ), {, }, [ and ], determine if the input string is valid.
An input string is valid if:
s.true if the string is valid, false otherwise.- `1 <= s.length <= 10^4` - `s` consists of parentheses only: `()[]{}`.
Return true or false.