Skip to content

Commit 179666b

Browse files
committed
x
1 parent b8b2c70 commit 179666b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

2024/Day23/Solution.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,20 @@ namespace AdventOfCode.Y2024.Day23;
1111
class Solution : Solver {
1212
public object PartOne(string input) {
1313
var g = GetGraph(input);
14-
var components = GetSeed(g);
14+
var components = g.Keys.ToHashSet();
1515
components = Grow(g, components);
1616
components = Grow(g, components);
17-
return components.Count(c => Members(c).Any(m=>m.StartsWith("t")));
17+
return components.Count(c => Members(c).Any(m => m.StartsWith("t")));
1818
}
1919

2020
public object PartTwo(string input) {
2121
var g = GetGraph(input);
22-
var components = GetSeed(g);
22+
var components = g.Keys.ToHashSet();
2323
while (components.Count > 1) {
2424
components = Grow(g, components);
2525
}
2626
return components.Single();
2727
}
28-
29-
HashSet<Component> GetSeed(Graph g) => g.Keys.ToHashSet();
3028

3129
HashSet<Component> Grow(Graph g, HashSet<Component> components) => (
3230
from c in components.AsParallel()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy