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 3cd3bbd commit 336e727Copy full SHA for 336e727
2024/src/day19.scala
@@ -24,8 +24,7 @@ def parse(input: String): (List[Towel], List[Pattern]) =
24
25
def part1(input: String): Int =
26
val (towels, patterns) = parse(input)
27
- val possiblePatterns = patterns.filter(isPossible(towels))
28
- possiblePatterns.size
+ patterns.count(isPossible(towels))
29
30
def isPossible(towels: List[Towel])(pattern: Pattern): Boolean =
31
val regex = towels.mkString("^(", "|", ")*$").r
0 commit comments