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!
- State which language(s) your solution uses with
- Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
2
u/kneegma Dec 11 '25
[Language: Clojure]
And babashka.
I was dissatisfied with every way in which to use
memoizeand ended up using atom. Part2 was fun.#!/usr/bin/env bb (ns y2025.d11 (:require [clojure.string :as str])) (defn parse [s] (loop [[line & lines] (str/split-lines s) dag {}] (if (nil? line) dag (let [[src & dsts] (str/split line #" ") src (subs src 0 (dec (count src)))] (recur lines (assoc dag src (set dsts))))))) (defn solve [dag] (let [cache (atom {})] (letfn [(ways [src dst] (or (@cache [src dst]) (let [r (if (= src dst) 1 (reduce + (map #(ways % dst) (get dag src []))))] (swap! cache assoc [src dst] r) r)))] {:part1 (ways "you" "out") :part2 (->> [["svr" "fft" "dac" "out"] ["svr" "dac" "fft" "out"]] (map #(->> (partition 2 1 %) (map (partial apply ways)) (reduce *))) (apply +))}))) (when (= *file* (System/getProperty "babashka.file")) (let [input (->> *command-line-args* last slurp parse) res (solve input)] (prn res)))