Microsoft interview question

Matching parenthesis question from the leetcode