Skip to content

Commit ff140e6

Browse files
committed
add new case & mod
1 parent 2b5acd6 commit ff140e6

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

Easy/valid_parentheses.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
)
6+
7+
func isValid(s string) bool {
8+
lenS := len(s)
9+
if lenS%2 == 0 || lenS > 10000 {
10+
return false
11+
}
12+
13+
// mapParentheses := map[string]string{
14+
// "(": ")",
15+
// "[": "]",
16+
// "{": "}",
17+
// }
18+
// strSplit := strings.Split(s, "")
19+
20+
// for i, c := range strSplit {
21+
// // if(i == 0 && Object.values(mapParentheses).includes(s[i])) {
22+
// // return false;
23+
// // }
24+
// }
25+
26+
return true
27+
}
28+
29+
func run_isValid() {
30+
fmt.Println(isValid("(]")) //false
31+
fmt.Println(isValid("()[]{}")) //true
32+
fmt.Println(isValid("([])")) //true
33+
fmt.Println(isValid("(}{)")) //false
34+
fmt.Println(isValid("([{}])")) //true
35+
fmt.Println(isValid("(){}}{")) //false
36+
fmt.Println(isValid("(([]){})")) //true
37+
}

Hard/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module leetcode_hard
2+
3+
go 1.24.3

Medium/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module leetcode_medium
2+
3+
go 1.24.3

0 commit comments

Comments
 (0)