Skip to content

Commit a56f335

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

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

2024/day23/solutions.py

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

0 commit comments

Comments
 (0)