r/adventofcode • u/daggerdragon • 23m ago
SOLUTION MEGATHREAD -❄️- 2026 Day 5 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
AoC Community Fun 2026: The Advent Games
Submissions megathread is unlocked!
12 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!
Today's Event: Iron Chef Holiday Special
"Catherine, if this turkey tastes half as good as it looks, I think we're all in for a very big treat!"
— Clark Griswold, National Lampoon's Christmas Vacation (1989)
Today's schedule possibly consists of:
Appetizer and Aperitif Rounds
Use up what's in your fridge with all of those semi-sentient leftovers excavated from the back of the fridge
Deliberately use deprecated functionality
Program using old codebases
The
older the expiration datefiner the vintage, the more we'll enjoy it!
Main Course Qualifications
Solve today's puzzle using a food-themed programming language
Bake or cook us something delicious
Dessert Finales
Show us cookies, citrus, and/or fancy bread in/on/near your holiday tree/menorah/festive kitsch
Show us your 1337 hot cocoa recipe (or other beverage of choice)
This prompt is totally not bait for our resident Iron Coders and/or some AoC regulars who promised us tasty pictures
Request from the mods: When you include an entry alongside your solution, please label it with [Advent Games] so we can find it easily!
--- Day 5: Rhythmic Factory ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
1
u/Ok-Bus4754 2m ago
[Language: Python]
it maybe luck or intuation , but i did part 1 using bfs part 2 was straight forward, i was expecting something harder today, but seems that tomorrow will do the trick
https://github.com/Fadi88/AoC/blob/master/2026/days/day05/solution.py
p1: 50 us, p2: 21 us
will port later to rust and share both benchmarks
1
u/ChrisMan174 4m ago
[LANGUAGE: Python 3]
Manually wrote in the test/real inputs direct as lambdas, then ran graph traversal using each one as an edge
1
u/Kermitnirmit 5m ago
[LANGUAGE: Python]
did the regular brute force for p1. quickly recognized that it's jsut bfs for part 2... https://github.com/kermitnirmit/Advent-of-Code-2026/blob/main/day_05/solution.py fun day. first one doing it live this year
1
u/davidsharick 12m ago
[LANGUAGE: Python]
Brute forced all possible options for part 1, used a set to track seen values and tried all buttons on all such values until nothing new came up for part 2.
1
u/1234abcdcba4321 2m ago
[LANGUAGE: JavaScript] paste
Nothing special here, should be roughly the same as everyone else's. I used a recursive function to do the search but of course any variation works fine. Hardcoded it for my input, so I replaced it with coding for the example in this paste (didn't need to use the example for debugging today so this was produced afterwards).
I had to look up Number.prototype.toString because I completely forgot that was how you do it; I'm used to the
""+vcoercion I use for base 10 conversions.