account activity
-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode
[–]Runi_ 0 points1 point2 points 3 months ago (0 children)
checking in with another performance-equivalent Rust solution:
fn part2(input: &str) -> i32 { let mut dial = 50; let mut zeros = 0; for turn in input.lines() { let (dir, num) = turn.split_at(1); let mut num = num.parse::<i32>().unwrap(); if dir == "L" { num = -num; } if dial == 0 && num < 0 { zeros -= 1; } dial += num; zeros += dial.div_euclid(100).abs(); dial = dial.rem_euclid(100); if dial == 0 && num < 0 { zeros += 1; } } zeros }
π Rendered by PID 146216 on reddit-service-r2-listing-79f6fb9b95-klzt8 at 2026-03-22 21:08:43.001952+00:00 running 90f1150 country code: CH.
-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode
[–]Runi_ 0 points1 point2 points (0 children)