Amazon interview question

Parenthesis matching similar to leetcode using stack