Skip to content

Commit f2e67a6

Browse files
refactor 921
1 parent a5b1678 commit f2e67a6

File tree

1 file changed

+0
-32
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-32
lines changed

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

-32
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,6 @@
22

33
import java.util.Stack;
44

5-
/**
6-
* 921. Minimum Add to Make Parentheses Valid
7-
*
8-
* Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions )
9-
* so that the resulting parentheses string is valid.
10-
*
11-
* Formally, a parentheses string is valid if and only if:
12-
* It is the empty string, 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-
* Given a parentheses string, return the minimum number of parentheses we must add to make the resulting string valid.
16-
*
17-
* Example 1:
18-
* Input: "())"
19-
* Output: 1
20-
*
21-
* Example 2:
22-
* Input: "((("
23-
* Output: 3
24-
*
25-
* Example 3:
26-
* Input: "()"
27-
* Output: 0
28-
*
29-
* Example 4:
30-
* Input: "()))(("
31-
* Output: 4
32-
*
33-
* Note:
34-
* S.length <= 1000
35-
* S only consists of '(' and ')' characters.
36-
* */
375
public class _921 {
386
public static class Solution1 {
397
public int minAddToMakeValid(String S) {

0 commit comments

Comments
 (0)