Pergunta de entrevista da empresa Bottomline

How to solve the matching parentheses Leetcode problem