Skip to content

Commit 2c8ae94

Browse files
committed
2024/19
1 parent 1f1f732 commit 2c8ae94

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

2024/Day19/Solution.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ long MatchCount(string[] towels, string pattern, Cache cache) =>
2929
cache.GetOrAdd(pattern, (pattern) =>
3030
pattern switch {
3131
"" => 1,
32-
_ => (
33-
from towel in towels
34-
where pattern.StartsWith(towel)
35-
select MatchCount(towels, pattern[towel.Length..], cache)
36-
).Sum()
32+
_ => towels
33+
.Where(pattern.StartsWith)
34+
.Sum(towel => MatchCount(towels, pattern[towel.Length ..], cache))
3735
}
3836
);
3937
}

0 commit comments

Comments
 (0)