Visa Inc. interview question

Valid Parantheses