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 03ab000Copy full SHA for 03ab000
2025/day03/solutions.py
@@ -0,0 +1,14 @@
1
+with open("input") as f:
2
+ ls = f.read().strip().split("\n")
3
+
4
5
+def joltage(a, to_choose):
6
+ res = i = 0
7
+ for end_index in range(len(a) - to_choose, len(a)):
8
+ i = max(range(i, end_index + 1), key=a.__getitem__) + 1
9
+ res = res * 10 + a[i - 1]
10
+ return res
11
12
13
+for to_choose in (2, 12):
14
+ print(sum(joltage(list(map(int, l)), to_choose) for l in ls))
0 commit comments