Return whether a string containing only parentheses, square brackets, and braces is balanced. Every closing bracket must match the most recent unmatched opening bracket.
Input / output
s: stringExamples
"()[]{}" returns true."([)]" returns false because the nesting order is invalid.Constraints
0 <= s.length <= 100,000s contains only parentheses, square brackets, and braces.Follow-up Can you reject impossible inputs early, and what information must the stack retain?