My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code python
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add 2025/11

+23
+23
2025/day11.py
··· 1 + import fileinput 2 + from collections import defaultdict 3 + from functools import cache 4 + 5 + 6 + @cache 7 + def ways(start, end): 8 + if start == end: 9 + return 1 10 + 11 + return sum(ways(n, end) for n in GRAPH[start]) 12 + 13 + # Read problem input. 14 + GRAPH = defaultdict(set) 15 + for line in fileinput.input(): 16 + node, other = line.strip().split(': ') 17 + for b in other.split(): 18 + GRAPH[node].add(b) 19 + 20 + # Solve problem. 21 + print("Part 1:", ways('you', 'out')) 22 + print("Part 2:", ways('svr', 'fft') * ways('fft', 'dac') * ways('dac', 'out')) 23 +