We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7806dd9 commit ebf5783Copy full SHA for ebf5783
src/main/kotlin/day10/day10.kt
@@ -4,7 +4,7 @@
4
package day10
5
6
import common.aocreader.fetchAdventOfCodeInput
7
-import common.gridalgorithms.neighbourPositions
+import common.gridalgorithms.*
8
import common.intpos2d.*
9
import common.runner.timedFunction
10
@@ -34,8 +34,7 @@ private fun findTrails(grid: List<List<Int>>): Map<IntPos2D, Trails> {
34
35
// Try all the valid neighbours.
36
val neighbours = grid.neighbourPositions(currentPos)
37
-// val neighbours = currentPos.neighbours(rows, cols)
38
-// .filter { coords -> grid[coords.first][coords.second] == currHeight + 1 }
+ .filter { (grid[it] ?: -1L) == currHeight + 1 }
39
if (neighbours.isEmpty()) return emptySet()
40
41
return neighbours.flatMap { pos -> aux(trailSoFar + pos) }.toSet()
0 commit comments