@@ -7,15 +7,15 @@ import (
77func 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