home.social

#day02 — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #day02, aggregated by home.social.

  1. CW: Advent of Code 2025 day 2 solution discussion

    Advent of Code, day 2 done.

    This one felt familiar. I remember previous years having digit grouping problems like this before. I remembered that doing it arithmetically in most cases performs much better than a string comparison, so that's how I approached this initially.

    Out of curiosity, I also converted each ID into a string and did a chunk-wise comparison, and it performed really well, taking only about 50% more time than the arithmetic solution. I'm sure my arithmetic solution could be faster, though. I initially used a String to hold the id, then switched to a stack array, but that didn't improve the speed at all. Glibc's allocator is really fast these days.

    #AdventOfCode #AdventOfCode2025 #AdventOfCode2025Day2 #AdventOfCode2025Day02 #Day2 #Day02 #Rust #RustLang #Programming #Coding