File tree 1 file changed +0
-27
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .util .Stack ;
4
4
5
- /**
6
- * 678. Valid Parenthesis String
7
- *
8
- * Given a string containing only three types of characters: '(', ')' and '*',
9
- * write a function to check whether this string is valid. We define the validity of a string by these rules:
10
-
11
- 1. Any left parenthesis '(' must have a corresponding right parenthesis ')'.
12
- 2. Any right parenthesis ')' must have a corresponding left parenthesis '('.
13
- 3. Left parenthesis '(' must go before the corresponding right parenthesis ')'.
14
- 4. '*' could be treated as a single right parenthesis ')' or a single left parenthesis '(' or an empty string.
15
- 5. An empty string is also valid.
16
-
17
- Example 1:
18
- Input: "()"
19
- Output: True
20
-
21
- Example 2:
22
- Input: "(*)"
23
- Output: True
24
-
25
- Example 3:
26
- Input: "(*))"
27
- Output: True
28
-
29
- Note:
30
- The string size will be in the range [1, 100].
31
- */
32
5
public class _678 {
33
6
public static class Solution1 {
34
7
/**
You can’t perform that action at this time.
0 commit comments