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 2aec849Copy full SHA for 2aec849
2024/day23/solutions.py
@@ -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