Education.com interview question

Valid paranthesis