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 6274fd4Copy full SHA for 6274fd4
2025/day03/solutions.py
@@ -0,0 +1,16 @@
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 = i = 0
9
+ for end_index in range(len(a) - to_choose + 1, len(a) + 1):
10
+ i += np.argmax(a[i:end_index]) + 1
11
+ res = res * 10 + a[i - 1]
12
+ return res
13
14
15
+for to_choose in (2, 12):
16
+ print(sum(joltage(list(map(int, l)), to_choose) for l in ls))
0 commit comments