Bloomberg interview question

Check if parentheses are valid or not