Bloomberg Interview Question

Check if parentheses are valid or not