Bloomberg Interview Question

LC20 (Valid Parentheses, with a twist)