Skip to content

Commit 03ab000

Browse files
committed
Add solution to 2025-12-03
1 parent 9696c5e commit 03ab000

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

2025/day03/solutions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)