Skip to content

Commit acf923e

Browse files
aQuaaQua
authored andcommitted
757 finish
1 parent d080c8f commit acf923e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Algorithms/0757.pyramid-transition-matrix/pyramid-transition-matrix.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import (
77
func pyramidTransition(bottom string, allowed []string) bool {
88
blocks := "#" + strings.Join(allowed, "#")
99

10-
var helper func(string, string, int, int) bool
11-
helper = func(bottom, blocks string, curr, length int) bool {
10+
var dfs func(string, int, int) bool
11+
dfs = func(bottom string, curr, length int) bool {
1212
if curr+2 > length {
1313
bottom = bottom[length:]
1414
length = len(bottom)
1515
if length == 1 {
1616
return true
1717
}
18-
return helper(bottom, blocks, 0, length)
18+
return dfs(bottom, 0, length)
1919
}
2020

2121
b := "#" + bottom[curr:curr+2]
@@ -27,13 +27,13 @@ func pyramidTransition(bottom string, allowed []string) bool {
2727
}
2828
beg = index + 4
2929
color := blocks[index+3 : index+4]
30-
if helper(bottom+color, blocks, curr+1, length) {
30+
if dfs(bottom+color, curr+1, length) {
3131
return true
3232
}
3333
}
3434

3535
return false
3636
}
3737

38-
return helper(bottom, blocks, 0, len(bottom))
38+
return dfs(bottom, 0, len(bottom))
3939
}

0 commit comments

Comments
 (0)