Three Kinds of Brackets — Solution & Editorial
Push opening brackets on a stack; on a closing bracket the stack top must be the matching opener.
Complexity: O(|S|)
Push opening brackets on a stack; on a closing bracket the stack top must be the matching opener.
Complexity: O(|S|)