Skip to content

Commit 85e6a4c

Browse files
committed
Add solution to 2025-12-11
1 parent 0f3c629 commit 85e6a4c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

2025/day11/solutions.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from functools import cache
2+
3+
with open("input") as f:
4+
ls = [l.split() for l in f.read().splitlines()]
5+
6+
succ = {start[:-1]: to for start, *to in ls}
7+
8+
9+
@cache
10+
def paths_from(node, dac_seen=True, fft_seen=True):
11+
dac_seen = dac_seen or node == "dac"
12+
fft_seen = fft_seen or node == "fft"
13+
if node == "out":
14+
return dac_seen and fft_seen
15+
return sum(paths_from(to_node, dac_seen, fft_seen) for to_node in succ[node])
16+
17+
18+
# Part 1
19+
print(paths_from("you"))
20+
21+
# Part 2
22+
print(paths_from("svr", False, False))

0 commit comments

Comments
 (0)