Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

Remove Invalid Parentheses (Main Thread)

Here is the interview question prompt, presented for reference.

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

![image](https://storage.googleapis.com/algodailyrandomassets/curriculum/hard-strings/remove-invalid-parenthesis/problem.png)

For example, consider the following string as input: s = "()())()" The correct solution should return ["(())()","()()()"], with both possibilities.

Note: this problem is similar to Minimum Parentheses Removal, with the difference being that we want to return all possible valid string results.

Constraints

  • 1 <= s.length <= 25
  • s consists of lowercase English letters and parentheses '(' and ')'.
  • There will be at most 20 parentheses in s.

You can see the full challenge with visuals at this link.

Challenges • Asked over 1 year ago by Jake from AlgoDaily

Jake from AlgoDaily Commented on Aug 14, 2022:

This is the main discussion thread generated for Remove Invalid Parentheses (Main Thread).

popsacred Commented on Sep 27, 2022:

Are there any excellent javascript to c# converters available to help in answering the questions?