Pregunta de entrevista de Amazon

Matching parentheses leetcode problem (same as found online)