Question d’entretien chez Bottomline

How to solve the matching parentheses Leetcode problem