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

Commitee03f24

Browse files
refactor 1021
1 parentf9425fe commitee03f24

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

‎src/main/java/com/fishercoder/solutions/_1021.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,6 @@
33
importjava.util.ArrayList;
44
importjava.util.List;
55

6-
/**1021. Remove Outermost Parentheses
7-
*
8-
* A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatenation. For example, "", "()", "(())()", and "(()(()))" are all valid parentheses strings.
9-
*
10-
* A valid parentheses string S is primitive if it is nonempty, and there does not exist a way to split it into S = A+B, with A and B nonempty valid parentheses strings.
11-
*
12-
* Given a valid parentheses string S, consider its primitive decomposition: S = P_1 + P_2 + ... + P_k, where P_i are primitive valid parentheses strings.
13-
*
14-
* Return S after removing the outermost parentheses of every primitive string in the primitive decomposition of S.
15-
*
16-
*
17-
* Example 1:
18-
* Input: "(()())(())"
19-
* Output: "()()()"
20-
* Explanation:
21-
* The input string is "(()())(())", with primitive decomposition "(()())" + "(())".
22-
* After removing outer parentheses of each part, this is "()()" + "()" = "()()()".
23-
*
24-
* Example 2:
25-
* Input: "(()())(())(()(()))"
26-
* Output: "()()()()(())"
27-
* Explanation:
28-
* The input string is "(()())(())(()(()))", with primitive decomposition "(()())" + "(())" + "(()(()))".
29-
* After removing outer parentheses of each part, this is "()()" + "()" + "()(())" = "()()()()(())".
30-
*
31-
* Example 3:
32-
* Input: "()()"
33-
* Output: ""
34-
* Explanation:
35-
* The input string is "()()", with primitive decomposition "()" + "()".
36-
* After removing outer parentheses of each part, this is "" + "" = "".
37-
*
38-
* Note:
39-
*
40-
* S.length <= 10000
41-
* S[i] is "(" or ")"
42-
* S is a valid parentheses string
43-
* */
446
publicclass_1021 {
457
publicstaticclassSolution1 {
468
publicStringremoveOuterParentheses(StringS) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp