diff --git a/2024/Day23/Solution.cs b/2024/Day23/Solution.cs index 07a79f57..e43da8f6 100644 --- a/2024/Day23/Solution.cs +++ b/2024/Day23/Solution.cs @@ -11,22 +11,20 @@ namespace AdventOfCode.Y2024.Day23; class Solution : Solver { public object PartOne(string input) { var g = GetGraph(input); - var components = GetSeed(g); + var components = g.Keys.ToHashSet(); components = Grow(g, components); components = Grow(g, components); - return components.Count(c => Members(c).Any(m=>m.StartsWith("t"))); + return components.Count(c => Members(c).Any(m => m.StartsWith("t"))); } public object PartTwo(string input) { var g = GetGraph(input); - var components = GetSeed(g); + var components = g.Keys.ToHashSet(); while (components.Count > 1) { components = Grow(g, components); } return components.Single(); } - - HashSet GetSeed(Graph g) => g.Keys.ToHashSet(); HashSet Grow(Graph g, HashSet components) => ( from c in components.AsParallel()