Remove Invalid Parentheses
Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid. Return all possible results.

30:00

Remove Invalid Parentheses
hard
Topics
Companies

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid. Return all possible results.

Example 1:
Input: {"s":"()())()"}
Output: ["(())()","()()()"]
Constraints:
  • 1s.length251 \leq s.\text{length} \leq 25

  • s consists of lowercase English letters and parentheses '(' and ')'.

  • There will be at most 2020 parentheses in s.

Input
arr ={"s":"()())()"}

Start BFS with original string "()())()"

Input String

(

)

(

)

)

(

)

BFS Queue (1 items)
()())()
Valid Results (0)

No valid strings found yet...

Removals: 0
Valid: 0
Variables
No variables to display
DepthFunction Call
Stack empty
0/5