Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit31813be

Browse files
refactor 1249
1 parent52856f2 commit31813be

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
packagecom.fishercoder.solutions;
22

3-
importjava.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
publicclass_1249 {
394
publicstaticclassSolution1 {
405
publicStringminRemoveToMakeValid(Strings) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp