1
0
This commit is contained in:
2020-12-01 07:29:31 +01:00
parent de750de96a
commit b470715f12
5 changed files with 259 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package be.vandewalleh.aoc.days
import be.vandewalleh.aoc.utils.Resources
object Day01 {
fun part1(list: List<Int>): Int? {
list.forEach { a ->
list.forEach { b ->
if (a + b == 2020) return a * b
}
}
return null
}
fun part2(list: List<Int>): Int? {
list.forEach { a ->
list.forEach { b ->
list.forEach { c ->
if (a + b + c == 2020) return a * b * c
}
}
}
return null
}
}
fun main() {
val input = Resources.ints("day01.txt").toList()
println(Day01.part1(input))
println(Day01.part2(input))
}