We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb4ce21 commit a56f335Copy full SHA for a56f335
2024/day23/solutions.py
@@ -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