Skip to content

Commit 31813be

Browse files
refactor 1249
1 parent 52856f2 commit 31813be

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

src/main/java/com/fishercoder/solutions/_1249.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
import java.util.Stack;
4-
5-
/**
6-
* 1249. Minimum Remove to Make Valid Parentheses
7-
*
8-
* Given a string s of '(' , ')' and lowercase English characters.
9-
* Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions )
10-
* so that the resulting parentheses string is valid and return any valid string.
11-
* Formally, a parentheses string is valid if and only if:
12-
* It is the empty string, contains only lowercase characters, or
13-
* It can be written as AB (A concatenated with B), where A and B are valid strings, or
14-
* It can be written as (A), where A is a valid string.
15-
*
16-
* Example 1:
17-
* Input: s = "lee(t(c)o)de)"
18-
* Output: "lee(t(c)o)de"
19-
* Explanation: "lee(t(co)de)" , "lee(t(c)ode)" would also be accepted.
20-
*
21-
* Example 2:
22-
* Input: s = "a)b(c)d"
23-
* Output: "ab(c)d"
24-
*
25-
* Example 3:
26-
* Input: s = "))(("
27-
* Output: ""
28-
* Explanation: An empty string is also valid.
29-
*
30-
* Example 4:
31-
* Input: s = "(a(b(c)d)"
32-
* Output: "a(b(c)d)"
33-
*
34-
* Constraints:
35-
* 1 <= s.length <= 10^5
36-
* s[i] is one of '(' , ')' and lowercase English letters.
37-
* */
383
public class _1249 {
394
public static class Solution1 {
405
public String minRemoveToMakeValid(String s) {

0 commit comments

Comments
 (0)