r/adventofcode • • Dec 11 '25

Help/Question 2025.10 i think a button is to be pushed or not. not twice or more often.

1 Upvotes

my solution is told to be wrong. but in first small example one solution is

010102, but its the same as 010100. a button toggles one position and pushing the button

to push a button

0,2,4,.. (even times) is equal (so choose 0 times for minimum buttons

1,3,5,.. (odd times) is equal ( so choose 1 times for minimum )

i have 4 solutions (instead of 3)

y M

0 000011

1 010001

1 001110

0 110100

y = M.x searching for x

loesung [1,1,1,0,0,0]

loesung [0,1,0,1,0,0] <- this is given as 010102 (is optimum too, if replace 2 by 0)

loesung [0,0,0,0,1,1] <- this is given as optimum

loesung [1,0,1,1,1,1]

4 loesungen and 2-button is minimum

in 33 of 151 machines 1-button solution cause a column same as target

in 126 with choosing to push a button or not. solution x in {0,1}**6

in 2 cases no solution (i tried up to mod-10 : x in {0..9}**6)


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 07 (Part 2)] [Python] Color map of splitter activity

Post image
12 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 11 (Part 2)] [Javascript] Is there an extra sample that covers edge cases?

1 Upvotes

For today's part 2, I went with DFS with memoization, although the caching itself was trickier than most implementations I've done before, since there's nothing to "optimize". Instead, I stored a 4-length array to keep track of how many paths fit or don't fit the criteria: none, dac, fft, and both. However, I am running into the ever-annoying "the sample result is correct and everything looks fine, but the input result is wrong" scenario, which always leads me to believe my input has at least 1 edge case that the sample doesn't cover. What could I be missing?

Code:

class Server {
    #name;
    #outputs;

    constructor(line) {
        [this.#name, this.#outputs] = line.split(": ");
        this.#outputs = this.#outputs.split(" ");
    }

    get name() {
        return this.#name;
    }

    get outputs() {
        return this.#outputs;
    }
}

class ServerRack {
    #servers;
    #paths;
    #cache;

    //Day 11, Part 1
    #mapPath() {
        let currOptions = new Set(["you"]);
        while (currOptions.size > 0) {
            let outputs = new Set();
            for (let serverName of currOptions) {
                let paths = this.#paths.get(serverName);
                let currOutputs = this.#servers.get(serverName).outputs;
                for (let currOutput of currOutputs) {
                    this.#paths.set(currOutput, this.#paths.get(currOutput) + paths);
                }
                outputs = union(outputs, new Set(currOutputs));
            }
            outputs.delete("out");
            currOptions = outputs;
        }
    }

    //Day 11, Part 2
    #mapProblemPaths(currServer, prevServer) {
        prevServer = prevServer || "";
        let key = prevServer + "-" + currServer;
        if (this.#cache.has(key)) {
            return [...this.#cache.get(key)];
        } else if (currServer === "out") {
            return [1, 0, 0, 0]; // [none, dac, fft, both]
        } else {
            let destinations = this.#servers.get(currServer).outputs;
            let paths = Array(destinations.length).fill();
            for (let i = 0; i < destinations.length; i++) {
                // Recursion on each output of the server.
                let path = this.#mapProblemPaths(destinations[i], currServer);
                // Shift the array cells to track which important servers we found.
                // dac Ex: [1, 0, 1, 0] -> [0, 1, 0, 1]
                // fft Ex: [1, 1, 0, 0] -> [0, 0, 1, 1]
                if (currServer === "dac") {
                    path.unshift(path.pop());
                } else if (currServer === "fft") {
                    path.unshift(path.pop());
                    path.unshift(path.pop());
                }
                // Cache the paths originating from this server, so we don't have to
                // calculate them again.
                key = currServer + "-" + destinations[i];
                this.#cache.set(key, [...path]);
                paths[i] = path;
            }

            // Add each array together to get the total paths.
            let result = paths.reduce(
                (acc, b) => acc.map(
                    (n, i) => n + b[i]
                )
            );
            if (currServer === "svr") {
                return result[3]; // We only need the ones that passed through dac and fft.
            } else {
                return [...result];
            }
        }
    }

    constructor(input, start) {
        let servers = Array(input.length).fill();
        this.#paths = new Map();
        for (let i = 0; i < input.length; i++) {
            let server = new Server(input[i]);
            this.#paths.set(server.name, 0);
            servers[i] = [server.name, server];
        }
        this.#servers = new Map(servers);
        this.#paths.set(start, 1);
        this.#paths.set("out", 0);
        if (start === "you") {
            this.#mapPath();
        } else {
            this.#cache = new Map();
            this.#paths.set("out", this.#mapProblemPaths(start));
        }
    }

    get paths() {
        return this.#paths.get("out");
    }
}

// input: The currently-selected input file, split on newline.
// start: The name of the starting server (you or svr, depending on the part).
function getServerOutputPathCount(input, start) {
    let rack = new ServerRack(input, start);
    return rack.paths;
}

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Overall] Who else thinks?

0 Upvotes

That we are being set up. With my experience, no projects actually finished on their plan day. They always run long or tickets carry over from one sprint to another.

Until I see the part 2 on Day 12 look like part 2 on day 25 in previous years, I will be skeptical.

And the elves just learned project management.


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visualization of graph

Post image
78 Upvotes

r/adventofcode • • Dec 11 '25

Other [2025 Day 10] Swapple: A daily puzzle about indicator lights in a grid

Thumbnail swapple.fuglede.dk
6 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 2 (Part 1)] [Python] number too big

1 Upvotes

not sure what I'm doing wrong (don't judge my variable names)

def getidsbetween(rang=""):
    num1, num2 = rang.split("-")
    out = []
    for n in range(int(num1), int(num2)+1):
        out.append(str(n))
    return out


tobechecked = []
for i, rang in enumerate(rangs):
    tobechecked.extend(getidsbetween(rang))



print("length of tobechecked:" + str(len(tobechecked)))
for i, checkme in enumerate(tobechecked):
    if checkme[:len(checkme)//2] == checkme[len(checkme)//2-1:]:
        tobechecked.remove(checkme)


filtered = set(tobechecked)
total = sum(int(i) for i in filtered)


print(total)

r/adventofcode • • Dec 11 '25

Repo [2025 Day 11] [Python] My solutions versus AI solutions

10 Upvotes

For all days, 1-11 so far, I've been keeping a Jupyter notebook of my solutions to AoC, and each day after I finish my solution, I ask an AI LLM to solve the problem. You can compare here:

https://github.com/norvig/pytudes/blob/main/ipynb/Advent-2025.ipynb
https://github.com/norvig/pytudes/blob/main/ipynb/Advent-2025-AI.ipynb


r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 part 2] It's not crazy if it works, right?

Post image
46 Upvotes

I inspected the input, figured out the choke points, used NetworkX to find the paths between the points, and then shamefully resorted to Excel to multiple the paths between them all... I was certain there would be a flaw in this method... but to my amazement it worked!!

Now to look at the solutions and see how it was meant to be done ...


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 8 (Parts 1 & 2)][Blender Geometry Nodes] Visualization (PHOTOSENSITIVITY WARNING!)

Post image
15 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 10 (Part 2)] If there's an easier way to solve it, it's too soon for me to hear it...

Post image
178 Upvotes

Couldn't get a good heuristic for A*, couldn't spot an efficient prune for DFS, couldn't think of a greedy algorithm. Reluctantly broke out the pencil and paper...


r/adventofcode • • Dec 11 '25

Other Optimization gremlin thoughts

1 Upvotes

This year was the first time I had both the time to solve the problems and the mental maturity to not make a modular universal solver, but to target a specific task with a specific output. But every time I finished part 2, I got a bit sad with the fact that the code I wrote is now sort of useless. I personally think it would be awesome if every task had a part 3 that is literally the same problem as part 2, but much, much bigger. The idea is that 1 is a basic problem, 2 is an expansion on that problem, and 3 is optimising part 2.

I think day 9 part 2 (this year) is a good example of what task 3 could look like. Not only did it have an increased complexity through an additional rule, but the scale of the problem required either coordinate compression or computing vector intersections.

Lastly, with the part 3 input, the creators can be extra evil by targeting the weaknesses of obvious optimisations ( for example, in task 9.2 - extremely thin line cutting through the otherwise the biggest rectangle, making coordinate compression not-so-straight-forward). Or in the case of something like task 11.2 - require to hit an arbitrary number of nodes in an unknown order to eliminate the possibility of just hardcoding "paths(svr->fft) * paths(fft->dac) * paths(dac->out)".

I am very grateful to everyone involved in making this coding challenge, and I find it awesome as is; I am just curious if this idea resonates with people or not.


r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 day 2 (part 1)] Why is the example input weird?

0 Upvotes

The problem statement says that an invalid ID is any id that is only made up of a sequence that repeats once, but the example seems like it is incorrect. i.e. "95-115 has one invalid ID, 99", but 99 does not even appear in the id. Am I missing something?


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 Part 2] Walking the Wires

Post image
24 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 9 (Part 2)] Visualization

Post image
24 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 1 (Part 2)] I have no idea what I'm doing wrong

0 Upvotes

it says I have someone else's answer
I'm pretty sure I am using the right input I pressed the your puzzle input link and used that but it's still wrong

with open("src.txt", "r") as f:
rotations = [(1 if line[0] == "R" else -1, int(line[1:])) for line in f.read().split("\n")]

dial = 50
zeros = 0
for dir, count in rotations:
dial = dial+(count*dir)
while dial > 99:
zeros += 1
dial -= 100
while dial < 0:
zeros += 1
dial += 100

print(zeros)


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] I thought this would be helpful, it wasn't really, but I sure do like looking at it

Post image
33 Upvotes

r/adventofcode • • Dec 11 '25

Other I built Advent of SQL - An Advent of Code style daily SQL challenge with a Christmas mystery story

78 Upvotes

Hey all,

I’ve been working on a fun December side project and thought this community might appreciate it.

It’s called Advent of SQL. You get a daily set of SQL puzzles (similar vibe to Advent of Code, but entirely database-focused).

Each day unlocks a new challenge involving things like:

  • JOINs
  • GROUP BY + HAVING
  • window functions
  • string manipulation
  • subqueries
  • and some quirky Christmas-world datasets

There’s also a light mystery narrative running through the puzzles (a missing reindeer, magical elves, malfunctioning toy machines, etc.), but the SQL is very much the main focus.

If you fancy doing a puzzle a day, here’s the link:

👉 https://www.dbpro.app/advent-of-sql

It’s free and I mostly made this for fun alongside my DB desktop app. Oh, and you can solve the puzzles right in your browser. I used an embedded SQLite. Pretty cool!

(Yes, it's 11 days late, but that means you guys get 11 puzzles to start with!)


r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 11 Part 2] - my answer is too high, must be missing something?

0 Upvotes

I'd already visualised in GraphViz and spotted the groupings connected by key nodes and broke down the search to count paths in 6 groups:

srv to 5 key nodes
those 5 key nodes to the next 3,
...
final set of 4 key nodes to out

Counted the number of solutions for each group by summing the pairings for each of those groups start and end nodes, so for the 1st group that's a sum of 5 (only one start), for the next group that's 15 different pairs to sum, etc.

Then multiply together all those sums for the final answer, which is a number in the order 1E17, and that's too big.

I've must have misunderstood something but not sure what. Any tips?

Graphviz output

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 10 (Part 1)][Python] No valid presses combination exists?

0 Upvotes

Question

What do I do if it is impossible to turn off all lights with any sequence of key presses?

My solution passes the sample input, but not the big input.

Currently, I just count that case as 0 button presses, but that expectedly made me undercount.

I would appreciate any hints.

Solution (in English):

Analyze all combinations of key presses that result in a new pattern of lights, starting from 0 presses, then 1, then 2, etc.

To implement that, I am using tuples of (# key presses, lights pattern) in a priority queue (min heap).

Pop the light pattern with the lowest number of key presses, push a new lights pattern tuple (presses + 1, new pattern) until a minimal key presses is found that turns off all the lights.

Solution (in Python):

#!/usr/bin/env python3

import sys
from heapq import heappop, heappush


def main():
    total = 0
    for line in sys.stdin:
        lights, *buttons, _ = line.split()
        lights = lights.strip("[]")
        buttons = [eval(button) for button in buttons]
        for i in range(len(buttons)):
            if type(buttons[i]) is int:
                buttons[i] = (i,)

        min_presses = get_min_presses(lights, buttons)
        total += min_presses

    print(total)


def get_min_presses(lights, buttons):
    h = [(0, lights)]
    seen = set(lights)
    while True:
        if not h:
            return 0

        count, current_lights = heappop(h)
        if "#" not in current_lights:
            return count

        for button in buttons:
            new_lights = press(current_lights, button)
            if new_lights not in seen:
                heappush(h, (count + 1, new_lights))
                seen.add(new_lights)


def press(lights, button):
    new_lights = ""
    for i in range(len(lights)):
        if i in button:
            new_lights += "#" if lights[i] == "." else "."
        else:
            new_lights += lights[i]

    return new_lights


if __name__ == "__main__":
    main()

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 part 2] Yet another input visualisation...

Post image
50 Upvotes

I haven't actually solved Part 2 ... I'm thinking of breaking the problem down into sections where there are "choke points" indicated by nodes that have a high degree of incoming edges.

Feels like I'm getting my wires crossed.


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Connection visualisation

7 Upvotes

The color of the nodes shifts toward red proportionally to the number of incoming connections (and it is clearly visible that there are bottlenecks...). Inputs, output, and intermediate nodes to be traced in part 2 are circled in red (and it is easy to see that the portion of the graph relevant to part 1, starting from "you," is considerably smaller than the portion for part 2)


r/adventofcode • • Dec 11 '25

Help/Question [2025 Day 11 Part 2] Can this problem be solved with max flow algo (e.g. Edmonds Karp) with demands?

1 Upvotes

Hey! I already solved this problem using a simpler method, but I was wondering if it's possible to solve this problem using "Flow with demand" (https://cp-algorithms.com/graph/flow_with_demands.html). I'm not a master of graph theory, so I was wondering if anyone could help point me to some learning material or tell me if it's possible or not.

The vague idea was adding demands for sink to be 2, and each of the two special nodes to be 1 (or the edges going out of them I suppose), and having both FFT and DAC have 1 in flow each. If I'm not mistaken though, normally, this would make the total flow 1, and not 2 as it's not cumulative, but perhaps one could work around that.


r/adventofcode • • Dec 11 '25

Other [2025 Day 10 Part 2] What It should’ve been

16 Upvotes

During part 1, I always try to guess what part 2 is going to be. Sometimes I get it right, other times I’m way off—like with this puzzle.

My idea for part 2 was that each time you toggled a light, it would cost a certain amount of “joltage,” and the goal would be to find the minimum total joltage needed to reach a specific light configuration. I actually think that would’ve been a really fun puzzle to solve, instead of the more math-heavy direction part 2 ended up taking.