Meta interview question

Balance parenthesis type problem