Advent of Code 2025 - December 11th

Published: (December 13, 2025 at 05:13 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Advent of Code 2025 - December 11th

In this series, I’ll share my progress with the 2025 version of Advent of Code.
Check the first post for a short intro to this series.
You can also follow my progress on GitHub.

December 11th

The puzzle of day 11 was fun and not as hard as the days before. I completed this day before part two of December 9 and both parts of December 10.

My pitfall for this puzzle

I was stuck on the second part with some complex bookkeeping code. A small hint on Reddit was needed to successfully complete part two.

#include 
#include 
#include 
#include 
#include 
#include 

struct Edge {
    const std::string from, to;
};

struct Graph {
    std::vector nodes;
    std::vector edges;
};

Graph loadInput(const std::string &filename) {
    Graph result;
    std::ifstream file(filename);
    std::string line;
    while (std::getline(file, line)) {
        auto colonIndex = line.find(':');
        std::string fromName = line.substr(0, colonIndex);
        result.nodes.push_back(fromName);
        for (unsigned int i = colonIndex + 2; i  visited, std::map &lookupMap) {
    std::vector next;
    for (const auto &[from, to] : g.edges) {
        if (from == startNode) {
            next.push_back(to);
        }
    }
    visited.insert(startNode);
    long result = 0;
    for (const auto &nextNode : next) {
        if (nextNode == endNode) {
            return 1;
        }
        if (visited.find(nextNode) == visited.end()) {
            if (lookupMap.find(nextNode) != lookupMap.end()) {
                result += lookupMap.at(nextNode);
            } else {
                auto count = walk(g, nextNode, endNode, visited, lookupMap);
                lookupMap.insert({nextNode, count});
                result += count;
            }
        }
    }
    return result;
}

long traces(const Graph &g, const std::string &startNode, const std::string &endNode) {
    std::map lookupMap;
    return walk(g, startNode, endNode, std::set(), lookupMap);
}

void partOne() {
    const auto graph = loadInput("/Users/rob/projects/robvanderleek/adventofcode/2025/11/input.txt");
    auto result = traces(graph, "you", "out");
    std::cout  lookupMap;
    long a1 = traces(graph, "svr", "dac");
    long a2 = traces(graph, "dac", "fft");
    long a3 = traces(graph, "fft", "out");
    long b1 = traces(graph, "svr", "fft");
    long b2 = traces(graph, "fft", "dac");
    long b3 = traces(graph, "dac", "out");
    long result = a1 * a2 * a3 + b1 * b2 * b3;
    std::cout << result << std::endl;
    assert(result == 662);
}

int main() {
    partOne();
    partTwo();
    return 0;
}

That’s it! See you again tomorrow!

Back to Blog

Related posts

Read more »

I tried Gleam for Advent of Code

Article URL: https://blog.tymscar.com/posts/gleamaoc2025/ Comments URL: https://news.ycombinator.com/item?id=46255991 Points: 39 Comments: 12...

Advent of Code 2025 - Day 5: Cafeteria

!Me solving AoC Day 5https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazo...

Advent of Code 2025 - December 8th

In this series, I'll share my progress with the 2025 version of Advent of Code. Check the first post for a short intro to this series. You can also follow my pr...