Problems > Three Kinds of Brackets > Editorial

Three Kinds of Brackets — Solution & Editorial

Back to the Problem

Push opening brackets on a stack; on a closing bracket the stack top must be the matching opener.

Complexity: O(|S|)