Bloomberg interview question

Valid parenthesis and subway system