Week 2 of AOC 2025
Problem solving is fun and satisfying, but it can be frustrating and time-consuming as well. I'm writing this while struggling to solve Part 2 of Day 9; it left a lingering aftertaste of frustration, and I decided to call it a day and start writing this post until I come back with some fresh ideas.
Nevertheless, I'm happy with this week's work: very fun problems, some easier than others, but I had a good time solving every one of them.
The following is a brief debrief of each day’s problem.
Day 3 - maximum number with digit placement constraints
This was fun. Part 2 required a recursive solution, which is always enjoyable to code. I had to cache the results because of the algorithm's complexity. The problem is: given a string of digits (e.g. 24321532135234324), which 12 digits should be picked to form the maximum possible number while preserving the original order of the digits?
Day 4 - Removing paper rolls
Given a grid containing either paper rolls or blanks, a paper roll can be removed if it has fewer than 3 neighbors. How many paper rolls can be removed if we repeatedly delete all removable rolls until no more can be deleted? This was a pretty straightforward problem and not too difficult to solve.
Day 5 - Compressing intervals
Probably the easiest Part 1 so far. It mostly consisted of parsing the input correctly and then checking whether each ingredient ID falls within one of the given valid intervals. For Part 2, the solution consisted of sorting the intervals and then compressing them to count how many unique IDs they contain, since the intervals can overlap.
Day 6 - Calculation while respecting padding
Day 7 - Taychon beam splitting
Day 8 - Connecting junction boxes
Day 9 - Red and Green Walls
Source Code : Part 1 Part 2 (failed attempts)
Part 1 was super easy. For Part 2, I gave up after about two hours and two failed attempts. The solution worked nicely on the sample input and smaller cases, but the Advent of Code input was too large for my approach. I'll try again another day with a better solution.
Thanks for reading!
Subscribe to get future posts via email
Add a comment
Comments (0)
Copyright © 2025 Abderrahmane Faiz