1249. Minimum Remove to Make Valid Parentheses #261
Unanswered
mah-shamim
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given a string s of
'('
,')'
and lowercase English characters.Your task is to remove the minimum number of parentheses (
'('
or')'
, in any positions ) so that the resulting parentheses string is valid and return any valid string.Formally, a parentheses string is valid if and only if:
AB
(A
concatenated withB
), whereA
andB
are valid strings, or(A)
, whereA
is a valid string.Example 1:
Example 2:
Example 3:
Constraints:
1 <= s.length <= 105
s[i]
is either'('
,')'
, or lowercase English letter.
Beta Was this translation helpful? Give feedback.
All reactions