feat: add solution 2025/01

This commit is contained in:
2025-12-01 07:16:36 +01:00
parent 0000000094
commit 0000001043
3 changed files with 36 additions and 0 deletions

10
data/example/2025/01.txt Normal file
View File

@@ -0,0 +1,10 @@
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82

View File

View File

@@ -0,0 +1,26 @@
from typing import Any
def part_1_2(input_data) -> Any:
d = 50
c1 = 0
c2 = 0
for line in input_data.splitlines():
dir = 1 if line[0] == "L" else -1
val = int(line[1:])
for _ in range(val):
d = (d + dir) % 100
if d == 0:
c2 += 1
if d == 0:
c1 += 1
return c1, c2
def test_part_1_2(example_data) -> None:
assert part_1_2(example_data) == (3, 6)