Morgan Stanley interview question

Valid Parentheses medium and project questions.