Skip to content

Commit 9b0110c

Browse files
committed
1096 more clean
1 parent 7ad1d55 commit 9b0110c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Algorithms/1096.brace-expansion-ii/brace-expansion-ii.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ var pres = []string{"a{", "b{", "c{", "d{", "e{", "f{", "g{", "h{", "i{", "j{",
99
var nows = []string{"a*{", "b*{", "c*{", "d*{", "e*{", "f*{", "g*{", "h*{", "i*{", "j*{", "k*{", "l*{", "m*{", "n*{", "o*{", "p*{", "q*{", "r*{", "s*{", "t*{", "u*{", "v*{", "w*{", "x*{", "y*{", "z*{", "}*{", "}*a", "}*b", "}*c", "}*d", "}*e", "}*f", "}*g", "}*h", "}*i", "}*j", "}*k", "}*l", "}*m", "}*n", "}*o", "}*p", "}*q", "}*r", "}*s", "}*t", "}*u", "}*v", "}*w", "}*x", "}*y", "}*z"}
1010

1111
func braceExpansionII(exp string) []string {
12-
exp = outBrace(exp)
13-
1412
for i, p := range pres {
1513
exp = strings.Replace(exp, p, nows[i], -1)
1614
}
@@ -20,6 +18,7 @@ func braceExpansionII(exp string) []string {
2018
}
2119

2220
func split(exp string, topSymbol byte) []string {
21+
exp = outBrace(exp)
2322
count := 0
2423
bytes := []byte(exp)
2524
for i, b := range bytes {
@@ -39,8 +38,6 @@ func split(exp string, topSymbol byte) []string {
3938
}
4039

4140
func doAdd(exp string) []string {
42-
exp = outBrace(exp)
43-
//
4441
if !strings.ContainsRune(exp, '{') {
4542
return strings.Split(exp, "+")
4643
}
@@ -54,7 +51,6 @@ func doAdd(exp string) []string {
5451
}
5552

5653
func doMultiply(exp string) []string {
57-
exp = outBrace(exp)
5854
strs := split(exp, '*')
5955
res := []string{""}
6056
for _, s := range strs {

0 commit comments

Comments
 (0)