Advent of Code Day 8

Published December 08, 2025

It's Day 8 and it was a bit of a doozie. I had an approach but it was a bit off. I knew my math was right but I had 2 small issues that caused it to work with the test data but not the actual data. So I went to Trey Hunner's solution for some inspiration. By looking at it I was able to understand where my issues were and to fix them.

Since part 1 was creating circuits from the first n closest connections and part 2 was building a circuit that connected all of them, it was very easy to tweak the solution to give the answers to both parts. All told my solution runs in ~900ms (which is way faster than the 2.7s it was when I solved part 1) since I was able to optimize out a not small number of redundant calculations.

Full solution is on my GitHub.


Previous: Advent of Code Day 7 Next: Advent of Code Day 9