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 9e56af6 commit ff8014dCopy full SHA for ff8014d
2024/src/day25.scala
@@ -0,0 +1,21 @@
1
+package day25
2
+
3
+import locations.Directory.currentDir
4
+import inputs.Input.loadFileSync
5
6
+@main def part1: Unit =
7
+ println(s"The solution is ${part1(loadInput())}")
8
9
+def loadInput(): String = loadFileSync(s"$currentDir/../input/day25")
10
11
+def part1(input: String): Int =
12
+ val (locks, keys) = input.split("\n\n").partition(_.startsWith("#"))
13
14
+ val matches = for
15
+ lock <- locks
16
+ key <- keys
17
+ if lock.zip(key).forall: (lockChar, keyChar) =>
18
+ lockChar != '#' || keyChar != '#'
19
+ yield lock -> key
20
21
+ matches.length
0 commit comments