Amazon interview question

valid parenthesis leetcode question (use a stack to solve)