day(01): refactor part 2
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
4186cf4815
commit
e3e721b6b4
1 changed files with 1 additions and 1 deletions
|
@ -4,7 +4,7 @@ import readInputAsInts
|
|||
|
||||
fun main() {
|
||||
fun part1(input: List<Int>): Int = input.windowed(2).count { it[0] < it[1] }
|
||||
fun part2(input: List<Int>): Int = part1(input.windowed(3).map { it.sum() }.toList())
|
||||
fun part2(input: List<Int>): Int = input.windowed(4).count { it[0] < it[3] }
|
||||
|
||||
val testInput = readInputAsInts(1, "test_input")
|
||||
val input = readInputAsInts(1, "input")
|
||||
|
|
Loading…
Reference in a new issue