We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f3c629 commit 85e6a4cCopy full SHA for 85e6a4c
2025/day11/solutions.py
@@ -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