Skip to content

Commit 2c506ee

Browse files
committed
Y21D1 improvement
1 parent 35fe367 commit 2c506ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pl/shockah/aoc/y2021/Day1.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Day1: AdventTask<List<Int>, Int, Int>(2021, 1) {
1010
}
1111

1212
private fun task(input: List<Int>): Int {
13-
return input.indices.toList().dropLast(1).count { input[it] < input[it + 1] }
13+
return input.windowed(2).count { (a, b) -> a < b }
1414
}
1515

1616
override fun part1(input: List<Int>): Int {

0 commit comments

Comments
 (0)