We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89824ad commit c56403aCopy full SHA for c56403a
src/main/scala/eu/sim642/adventofcode2025/Day1.scala
@@ -18,13 +18,9 @@ object Day1 {
18
19
object Part2 extends Part {
20
override def password(rotations: Seq[Int]): Int = {
21
- rotations
22
- .flatMap({ // expand all rotations to single to make each tick observable, this is silly but works
23
- case i if i >= 0 => Seq.fill(i)(1)
24
- case i if i < 0 => Seq.fill(-i)(-1)
25
- })
26
- .scanLeft[Int](50)((a, b) => (a + b) %+ 100) // TODO: why can't use implicit arguments?
27
- .count(_ == 0)
+ // expand all rotations to single to make each click observable, this is silly but works
+ val newRotations = rotations.flatMap(i => Seq.fill(i.abs)(i.sign))
+ Part1.password(newRotations)
28
}
29
30
0 commit comments