IBM interview question

Valid Parentheses Leet code question