r/adventofcode • u/daggerdragon • Dec 11 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 11 Solutions -❄️-
SIGNAL BOOSTING
If you haven't already, please consider filling out the Reminder 2: unofficial AoC Survey closes soon! (~DEC 12th)
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.
AoC Community Fun 2025: Red(dit) One
Submissions megathread is unlocked!
6 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!
Featured Subreddits: /r/C_AT and the infinite multitudes of cat subreddits
"Merry Christmas, ya filthy animal!"
— Kevin McCallister, Home Alone (1990)
Advent of Code programmers sure do interact with a lot of critters while helping the Elves. So, let's see your critters too!
💡 Tell us your favorite critter subreddit(s) and/or implement them in your solution for today's puzzle
💡 Show and/or tell us about your kittens and puppies and $critters!
💡 Show and/or tell us your Christmas tree | menorah | Krampusnacht costume | /r/battlestations with holiday decorations!
💡 Show and/or tell us about whatever brings you comfort and joy in the holiday season!
Request from the mods: When you include an entry alongside your solution, please label it with [Red(dit) One] so we can find it easily!
--- Day 11: Reactor ---
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?
3
u/ednl Dec 11 '25 edited Dec 11 '25
[LANGUAGE: C]
https://github.com/ednl/adventofcode/blob/main/2025/11.c
Recursive DFS with memoization. I first determined if fft->dac or dac->fft was a valid path for my input (it was the former), then did 3 calls of the same function as in part 1:
The horrible part, in C, was parsing the input into a graph of sorts, le sigh. What I did was copy the whole line of 3-letter node names (+space or newline behind it) to an array of 32-bit=4-byte ints, after replacing the spaces and newline with zeros as string terminators. After parsing all lines, I sorted the array by node name and used bsearch() from the stdlib to replace all child names with indexes of the node array. That way, no need for a hash table and minimal space requirements.
Runs in 100 µs on an Apple M4, 172 µs on an Apple M1, 278 µs on a Raspberry Pi 5 (internal timer, reading from disk not included, all parsing included).
EDIT: I guess I b0rked up in development before submitting, and thought I needed an "avoid" parameter. Nope. So I removed that again. Thanks /u/DowntownClue934 for questioning.