Minimum Remove to Make Valid Parentheses

Remove the minimum number of parentheses, leaving matching parentheses in the input string.

Statement

Given a string with matched and unmatched parentheses, remove the minimum number of parentheses with all matching parentheses in the string.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.