This commit is contained in:
Paul-Henri Froidmont 2022-12-06 06:10:41 +01:00
parent b9465481a1
commit 53d5b39e80
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
2 changed files with 18 additions and 0 deletions

17
aoc/src/Day6.scala Normal file
View file

@ -0,0 +1,17 @@
import scala.io.Source
object Day6 extends App:
val input = Source
.fromURL(getClass.getResource("day6Input.txt"))
.mkString
.split('\n')
.toList
val part1 = input.head.sliding(4).indexWhere(_.distinct.length == 4) + 4
println(s"Part 1: $part1")
val part2 = input.head.sliding(14).indexWhere(_.distinct.length == 14) + 14
println(s"Part 2: $part2")