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 3f4f716 commit 1642769Copy full SHA for 1642769
src/main/scala/eu/sim642/adventofcode2024/Day25.scala
@@ -13,11 +13,7 @@ object Day25 {
13
14
def countLockKeyFits(lockKeys: Seq[Grid[Boolean]]): Int = {
15
val (keys, locks) = lockKeys.partition(isKey)
16
- (for {
17
- key <- keys
18
- lock <- locks
19
- if fits(key, lock)
20
- } yield ()).size
+ keys.view.map(key => locks.count(fits(key, _))).sum
21
}
22
23
def parseLockKey(s: String): Grid[Boolean] = s.linesIterator.map(_.map(_ == '#').toVector).toVector
0 commit comments