Piotr Czajkowski há 1 ano atrás
pai
commit
99130f146f
1 ficheiros alterados com 3 adições e 2 exclusões
  1. 3 2
      23/code.go

+ 3 - 2
23/code.go

@@ -134,8 +134,9 @@ func calculate(board [][]byte) int {
 			break
 		}
 
-		current := frontier[0]
-		frontier = frontier[1:]
+		last := len(frontier) - 1
+		current := frontier[last]
+		frontier = frontier[:last]
 
 		if current.x == goal.x && current.y == goal.y {
 			if max < current.steps {