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 9696c5e commit 38cb7b1Copy full SHA for 38cb7b1
2025/day03/solutions.py
@@ -0,0 +1,17 @@
1
+import numpy as np
2
+
3
+with open("input") as f:
4
+ ls = f.read().strip().split("\n")
5
6
7
+def joltage(a, to_choose):
8
+ res = 0
9
+ i = -1
10
+ for remaining in range(to_choose, 0, -1):
11
+ i += np.argmax(a[i + 1 : len(a) - remaining + 1]) + 1
12
+ res = res * 10 + a[i]
13
+ return res
14
15
16
+for to_choose in (2, 12):
17
+ print(sum(joltage(list(map(int, l)), to_choose) for l in ls))
0 commit comments