1
0

Prepare for other years

This commit is contained in:
2020-12-30 18:01:52 +01:00
parent 522618d106
commit 4a90257257
81 changed files with 277 additions and 253 deletions
+23
View File
@@ -0,0 +1,23 @@
package be.vandewalleh.aoc.days
import be.vandewalleh.aoc.utils.input.Day
import be.vandewalleh.aoc.utils.input.Input
import be.vandewalleh.aoc.utils.input.Lines
@Day(5)
class Day05(@Lines val input: Input<List<String>>) {
private val ids = input.value.map {
it.replace("F", "0")
.replace("B", "1")
.replace("L", "0")
.replace("R", "1")
.toInt(2)
}.sorted()
fun part1() = ids.last()
fun part2() = ids.windowed(size = 2, step = 1)
.find { (a, b) -> b - a > 1 }!!
.first() + 1
}