Back to problems

Remove Invalid Parentheses (Minimum Removal, Return All Valid Strings)

Algorithm · Bloomberg · Hard

You receive a string s made up of '(', ')', plus letters or any other characters that are not parentheses. Discard as few parenthesis characters as possible so the remaining text has correctly balanced parentheses. Produce every distinct string obtainable with that minimum deletion count. The ordering of the returned strings is irrelevant. A parenthesis sequence is considered valid when: At no point while scanning left to right do closing parentheses outnumber opening…

Checking your access…