MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / path

Function path

2018/src/07.py:4–9  ·  view source on GitHub ↗
(reqs: dict[str,list[str]])

Source from the content-addressed store, hash-verified

2from collections import defaultdict
3
4def path(reqs: dict[str,list[str]]) -> str:
5 left, ans = sorted(reqs.keys()), ""
6 while left:
7 ans += next(x for x in left if not any(r in left for r in reqs[x]))
8 left.remove(ans[-1])
9 return ans
10
11def part2(reqs: dict[str,list[str]]) -> int:
12 left, working, t = sorted(reqs.keys()), dict[str,int](), 0

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected