Skip to content

Commit 2aec849

Browse files
committed
Add solution to 2024-12-23
1 parent cb4ce21 commit 2aec849

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

2024/day23/solutions.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import networkx as nx
2+
3+
4+
with open("input") as f:
5+
ls = f.read().strip().split("\n")
6+
7+
G = nx.Graph(l.split("-") for l in ls)
8+
cliques = list(nx.enumerate_all_cliques(G))
9+
10+
# Part 1
11+
print(sum(len(c) == 3 and any(x[0] == 't' for x in c) for c in cliques))
12+
13+
# Part 2
14+
print(",".join(sorted(cliques[-1])))

0 commit comments

Comments
 (0)