Skip to content

Instantly share code, notes, and snippets.

@bfontaine
Last active November 16, 2019 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfontaine/7afe26dc3dbd823ccef86e154f314bd1 to your computer and use it in GitHub Desktop.
Save bfontaine/7afe26dc3dbd823ccef86e154f314bd1 to your computer and use it in GitHub Desktop.
Solution to Advent of Code 2018 problem 7.1 in Python3 in 163 chars. Your input file must be named "T".
G={}
for L in open("T"):a,b=L[5::31];G={a:set(),**G};G[b]=G.get(b,{a})|{a}
while G:C=min(c for c in G if not G[c]);G={c:G[c]-{C}for c in G if c!=C};print(C,end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment