Crunchbase interview question

variation on Valid Parentheses problem.