diff --git a/2024/day23/solutions.py b/2024/day23/solutions.py new file mode 100644 index 0000000..e9c589a --- /dev/null +++ b/2024/day23/solutions.py @@ -0,0 +1,15 @@ +from itertools import combinations +import networkx as nx + + +with open("input") as f: + ls = f.read().strip().split("\n") + +G = nx.Graph(l.split("-") for l in ls) +cliques = list(nx.enumerate_all_cliques(G)) + +# Part 1 +print(sum(len(c) == 3 and "t" in {x[0] for x in c} for c in cliques)) + +# Part 2 +print(",".join(sorted(cliques[-1])))