From e3e721b6b4d1c5522154c09df23b55d8d8ee4169 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sat, 4 Dec 2021 15:16:12 +0100 Subject: [PATCH] day(01): refactor part 2 Signed-off-by: Matej Focko --- src/day01/Day01.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/day01/Day01.kt b/src/day01/Day01.kt index fce4b05..980d48a 100644 --- a/src/day01/Day01.kt +++ b/src/day01/Day01.kt @@ -4,7 +4,7 @@ import readInputAsInts fun main() { fun part1(input: List): Int = input.windowed(2).count { it[0] < it[1] } - fun part2(input: List): Int = part1(input.windowed(3).map { it.sum() }.toList()) + fun part2(input: List): Int = input.windowed(4).count { it[0] < it[3] } val testInput = readInputAsInts(1, "test_input") val input = readInputAsInts(1, "input")