Snapsheet interview question

matching parentheses