This repository contains my solutions for the Advent of Code 2025 in Rust.
Unlike last year, this year, I have decided to take a different approach in organizing my solutions:
- Each day's solution is contained within its own crate (e.g.,
day01,day02, etc.), so that multiple files for a single day can be possible. - A shared utility crate (
util) is created to hold common functionalities used across different days, such as input reading and parsing. - No more top-level binary crate; instead, each day's crate is a binary crate itself. This also means no more macro-based solution definition.
- A workspace is set up to manage all the crates together. Testing and building can be done from the workspace root.
The core idea is to leverage Rust's crate system and Cargo's workspace feature to reduce the boilerplate and improve code organization.
Although not the primary focus of my solutions, I tried my best to find the most efficient approach to each day's puzzle, which might take advantage of certain structures of the problem input thus not directly comparable with general solution to the described problem.
Below are the benchmarking result of different part of the solutions, ran on M1 max with 64G RAM. The median
| Day | Parsing | Part 1 | Part 2 | Note |
|---|---|---|---|---|
| 01 | 111.125 |
18.250 |
20.667 |
|
| 02 | 30.292 |
16.625 |
29.167 |
Prime factors decomposition |
| 03 | 158.395 |
96.875 |
200.000 |
Dynamic programming |
| 04 | 180.209 |
111.583 |
12.038 |
|
| 05 | 70.625 |
23.542 |
19.584 |
Binary search |
| 06 | 107.375 |
40.625 |
117.583 |
|
| 07 | 816.396 |
3.375 |
3.083 |
Dynamic programming (I guess) |
| 08 | 227.083 |
698.417 |
24.027 |
Octree + Branch and Bound |
| 09 | 67.145 |
2.552 |
9.382 |
Intersection of edges |
| 10 | 192.104 |
439.562 |
90.178 |
Divide and conquer |
| 11 | 311.895 |
1.359 |
1.293 |
Dynamic programming |
| 12 | 163.166 |
48.458 |
N/A | 😅 |
This project is licensed under the MIT OR Apache-2.0 License. See the LICENSE-MIT and LICENSE-APACHE files for details.