File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ module leetcode_hard
2
+
3
+ go 1.24.3
Original file line number Diff line number Diff line change
1
+ module leetcode_medium
2
+
3
+ go 1.24.3
You can’t perform that action at this time.
0 commit comments