AoC of 2025
This time I managed to finish all AoC challenges within a week of
problems being published.
My solutions: https://github.com/trofi/AoC/tree/main/2025.
First 9 problems I managed to do in a day they were published. But the
10th one was tough.
As usual I tried to solve the problems within 24 hours of publish
time and get the source code under 4K. I used rust again. I did not
use any external crates.
This time I also attempted to handle errors in a more graceful way to
avoid .unwrap() / .expect("") calls. I found a few nice patterns
like collecting into Result<Vec<_>>:
$ evcxr
>> #[derive(Debug)] struct E{}
>> [Ok(1),Ok(3),Ok(5)].into_iter().collect::<Result<Vec<_>, E>>()
Ok([1, 3, 5])Or reducing Result values:
>> [Ok(1),Ok(3),Ok(5)].into_iter().sum::<Result<isize, E>>()
Ok(9)
I felt I did a bit too much .map_err() conversions to capture more into
error context. I also relied on Debug instances instead of Display
as I allowed main() to return by error type outside main(). There
probably are better mechanisms to achieve the same. But otherwise error
propagation is quite pleasant in rust.
Funniest problems
No pencil-and-paper problems this time. All required a program to write.
I did solve a few examples from Day 10 by hand to explore it a bit
better. A few of the problems had very interesting problem statement:
- Day 8: Playground is a nice concise definition of a large input graph.
- Day 10: Factory tricked me into searching for a brute force solution. After failing that I managed to see a nice system of equations and a function to minimize. I did not solve the minimization part nicely, but I liked the equation solver.
It felt like first few problems had very gnarly corner cases to handle. I was afraid the problem complexity will really go up. But it was just about right for me.
Have fun!