Advent of Code Speedrunning: 2025, Day 5

Today’s Advent of Code challenge involved calculating the union of massive ranges.

Eventually, after a quick search on crates.io, I found a neat little crate, range_union_find, that could allow me to not have to reinvent the wheel. “Implementing” an efficient strategy was as simple as this:

cargo add range_union_find
use range_union_find::RangeUnionFind;

I knew that a Vec with all elements really wouldn’t cut it (who has enough memory for 250 entries?), and getting any ad-hoc implementation to work right was guaranteed to be massive a pain in the neck. I did what came to my mind: it wasn’t a matter of pride, it was a matter of efficiency.

Moral of the story: work smarter, not harder.