Amazon Interview Question

How do you match parantheses?