Skip to content

Commit ee03f24

Browse files
refactor 1021
1 parent f9425fe commit ee03f24

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

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

-38
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,6 @@
33
import java.util.ArrayList;
44
import java.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
public class _1021 {
457
public static class Solution1 {
468
public String removeOuterParentheses(String S) {

0 commit comments

Comments
 (0)