Remove Invalid Parentheses
Try to solve the Remove Invalid Parentheses problem.
We'll cover the following
Statement
You are given a string, s
, that contains:
Lowercase English letters
Opening
'('
and closing')'
parentheses
A string is considered valid if:
All opening parentheses
'('
are closed properly by a matching')'
.The parentheses are in the correct order and nesting.
Letters can appear anywhere and do not affect validity.
Return all possible valid strings that can be formed by removing the minimum number of invalid parentheses. The answer must be a list of unique strings, in any order.
Constraints:
s.length
s
 consists of lowercase English letters and parenthesesÂ'('
 andÂ')'
.There will be at mostÂ
20
 parentheses inÂs
.
Examples
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.