Răsfoiți Sursa

Solved part1

Piotr Czajkowski 2 ani în urmă
părinte
comite
fbfd3d2082
1 a modificat fișierele cu 4 adăugiri și 4 ștergeri
  1. 4 4
      09/code.go

+ 4 - 4
09/code.go

@@ -38,19 +38,19 @@ func readInput(file string) [][]int {
 }
 
 func hasSmallerNeighbors(input [][]int, x, y int) bool {
-	if x-1 >= 0 && input[x-1][y] < input[x][y] {
+	if x-1 >= 0 && input[x-1][y] <= input[x][y] {
 		return true
 	}
 
-	if x+1 < len(input) && input[x+1][y] < input[x][y] {
+	if x+1 < len(input) && input[x+1][y] <= input[x][y] {
 		return true
 	}
 
-	if y-1 >= 0 && input[x][y-1] < input[x][y] {
+	if y-1 >= 0 && input[x][y-1] <= input[x][y] {
 		return true
 	}
 
-	if y+1 < len(input[0]) && input[x][y+1] < input[x][y] {
+	if y+1 < len(input[0]) && input[x][y+1] <= input[x][y] {
 		return true
 	}