New York Times interview question

Valid parentheses leetcode easy question