Skip to content

Commit a1672f0

Browse files
committed
Add solution to 2025-12-02
1 parent 8723fb4 commit a1672f0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

2025/day02/solutions.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
with open("input") as f:
2+
data = f.read().strip()
3+
4+
res1 = res2 = 0
5+
6+
for l in data.split(","):
7+
start, end = l.split("-")
8+
for i in range(int(start), int(end) + 1):
9+
s = str(i)
10+
for l in range(1, len(s) // 2 + 1):
11+
if len(s) % l == 0:
12+
if s == s[0:l] * (len(s) // l):
13+
res2 += i
14+
if l == len(s) // 2:
15+
res1 += i
16+
break
17+
18+
# Part 1
19+
print(res1)
20+
21+
# Part 2
22+
print(res2)

0 commit comments

Comments
 (0)