MathWorks interview question

valid parentheses