You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/1201-1300/1249.Minimum-Remove-to-Make-Valid-Parentheses/README.md
+24-13Lines changed: 24 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,39 @@
1
1
# [1249.Minimum Remove to Make Valid Parentheses][title]
2
2
3
-
> [!WARNING|style:flat]
4
-
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5
-
6
3
## Description
4
+
Given a string s of `'('` , `')'` and lowercase English characters.
5
+
6
+
Your task is to remove the minimum number of parentheses ( `'('` or `')'`, in any positions ) so that the resulting parentheses string is valid and return **ans** valid string.
7
+
8
+
Formally, a parentheses string is valid if and only if:
9
+
10
+
- It is the empty string, contains only lowercase characters, or
11
+
- It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are valid strings, or
12
+
- It can be written as `(A)`, where `A` is a valid string.
13
+
7
14
8
15
**Example 1:**
9
16
10
17
```
11
-
Input: a = "11", b = "1"
12
-
Output: "100"
18
+
Input: s = "lee(t(c)o)de)"
19
+
Output: "lee(t(c)o)de"
20
+
Explanation: "lee(t(co)de)" , "lee(t(c)ode)" would also be accepted.
0 commit comments