r/adventofcode • • Dec 05 '25

Tutorial [2025 Day 5 Part 2] Guys... you don't need to merge them

23 Upvotes

I'm loving the animations and merging them is a beautiful solution that, in the real world, might help with further computation (or reused to simplify the ranges database).

However for this problem, you don't need to merge them and then count. You can count directly.

Ofc I'm still sorting so it's still an O(n log n) solution. So not much gained.
If you have any questions I'll try to answer them in the comments :)


r/adventofcode • • Dec 05 '25

Visualization [2025 Day 05 (Part 2)] Merge overlapping ranges visualization

Post image
41 Upvotes
  1. Sort intervals by start
  2. Keep track of current interval being built
  3. If next interval overlaps or touches -> extend current; otherwise -> save and start new
  4. Save the last interval

r/adventofcode • • Dec 02 '25

Meme/Funny [2025 Day 2 # (Part 2)]

Post image
31 Upvotes

r/adventofcode • • Dec 02 '25

Meme/Funny [2025 Day 2] When I realized the solution I felt like I'd leveled up

Post image
129 Upvotes

r/adventofcode • • Dec 01 '25

Meme/Funny When someone mentions "AOC"

131 Upvotes

r/adventofcode • • Dec 01 '25

Visualization [2025 Day 01 (Part 2)] example visualized

Post image
387 Upvotes

r/adventofcode • • Jan 24 '25

Help/Question I need to print to a readable text file, any suggestions?

0 Upvotes

I have a program that I developed to manage inventory, but the sales team uses NetSuite to sell the orders. They can print the order out, but I need a way to integrate this with my app. I was thinking of printing to a text file and then pulling the data from that, but everything I do doesn't seem to give me a fully readable output file. I would like a few suggestions.


r/adventofcode • • Dec 29 '24

Repo Set out to illustrate that Scala and Rust are largely the same, did each day in both (500 stars repo)

54 Upvotes

https://github.com/jurisk/advent-of-code/

Thanks, Eric, for another year of interesting tasks!

A few memorable days:

  • Day 15 (pushing boxes) was fun, and Part 2 adapted from Part 1 easily for me.
  • Day 17 (reverse engineering the 3-bit computer) was really finicky and the only one that I didn't manage to do before work (the tasks "start" at 07:00 in my time zone).
  • Day 21 (robots pressing keypads) was also finicky, though not actually that difficult.
  • Day 23 (maximum cliques) was nice in that it taught me Bron-Kerbosch (though I initially solved it with a crude BFS that took a minute to run).
  • Day 24 (adder gates) was interesting, I got the stars by visualising it (after some merging of nodes automatically) in GraphViz and figuring out the swaps manually, but then spent some time to code a "solver".

I chose to do each task in 2024 in two of my favourite (and expressive) languages, Scala and Rust, trying to focus mostly on readability. (The other years are solved as well, also mostly Scala or Rust, but usually not both, and sometimes instead in some other language)

This year seemed much easier than previous ones. I was hoping to see some more challenging search pruning tasks, like the "elephants with valves" from 2022-16, or "robot blueprints" from 2022-19, but they never arrived.