Skip to content

Commit

Permalink
Add solution to 2024-12-23
Browse files Browse the repository at this point in the history
  • Loading branch information
fuglede committed Dec 23, 2024
1 parent cb4ce21 commit 7e5fc5f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 2024/day23/solutions.py
Original file line number Diff line number Diff line change
@@ -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(cliques[-1]))

0 comments on commit 7e5fc5f

Please sign in to comment.