Lookout interview question

Valid parentheses (stack) leetcode question