We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6956fba commit 4a1ac51Copy full SHA for 4a1ac51
src/main/kotlin/com/cluddles/aoc/y2024/Day18.kt
@@ -73,12 +73,12 @@ object Day18: Solver<Grid<Int>, String> {
73
val current = (min + max) / 2
74
val valid = (solvePart1(input, current) != Int.MAX_VALUE)
75
if (valid) {
76
- min = maxOf(current, min + 1)
+ min = current
77
} else {
78
- max = minOf(current, max - 1)
+ max = current
79
}
80
81
- return with (input.iterableWithPos().first { it.data == max-1 }) { "$x,$y" }
+ return with (input.iterableWithPos().first { it.data == min }) { "$x,$y" }
82
83
84
0 commit comments