Amazon interview question

How do you match parantheses?