Uber interview question

Parentheses matching