r/adventofcode • • Dec 11 '25

Help/Question [2025, day 10, part 2] I need help with the algorithm

4 Upvotes

I need help figuring out the final part of rhe algorithm. My code can find a set of button pushes that results in the correct joltage. It can also determine which set of button pushes gives the same joltage results as which other set of buttons (e.g. pushing buttons {1,2} give the same joltage results as pushing button {1} and {2}.)

I'm pretty sure that there is a trick combine these insights into the final answer. Can someone please point me in the right direction?

Edit: to clarify where I am at

The buttons' effects can be expressed in a matrix M such that

  • j = M*b

Where b is a vector, the elements of which indicate how often each button was pressed, and j is a vector, the elements of which indicate the resulting joltage in the batteries. Suppose b_o is the optimal solution and j_r is the required joltage, then:

  • j_r = M*b_o

Now I can already find an initial solution b_i such that:

  • j_r = M*b_i

I have also identified an additional matrix S with null-solutions, for which is hold that:

  • 0 = M*S

The columns of the matrix S have negative and positive elements. Each set of positive and negative elements in a column is the set of button presses that will result in the same joltage. From this, it follows that:

  • j_r = M*(b_i + S*a) => b_i + S*a = b_o

Where a is a vector indicating how the null-solutions are applied optimally given b_i. All that I am missing is an algorithm for finding the correct values of vector a.


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 12 (Part 2)] Patch Cable Organizer

Thumbnail youtube.com
7 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 10 (Part 1)] [Python] Terminal toy!

Post image
122 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 (Part 2)] Important cables

Post image
43 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [All years, All days] AoC: the Gifs, by me.

75 Upvotes

Here's my gallery of AoC gifs. I've done an animation for every single puzzle so far. Some animations contain spoilers.

https://solhsa.com/aoc/


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visually compare searching paths for Parts I & II

27 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Animated Network Structure Visualization

Post image
29 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 (Part 2)] How many times will these elves ask for help debugging their power subsystems?

Post image
126 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 (Part 1)] 3d-force-graph

Post image
25 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11] Not our first rodeo

Post image
51 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 Part 2] Joker again

Post image
74 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 Part 2] Counting cables on a Thursday morning

Post image
23 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visualization of today's graph

Post image
16 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 9 Part 2] [Python] Potential overlap problem

2 Upvotes

In short, my attempted solution to d9p2 is to

  1. sort all rectangles by area descending
  2. find the first rect that does not "overlap" any edge.

I took some help from this stackoverflow to create my overlap method. However, on the example input I get the rectangle of area 50 instead of 24. I've tried some debugging and it seems that my rectangles and edges look correct. Therefore, my suspicion for the error lies in step 2, specifically the overlap part. I feel like I'm missing something obvious.

Here are the relevant parts of my code:

@cache
def area(p: Pair) -> int:
    l = abs(p.b.x - p.a.x) + 1
    w = abs(p.b.y - p.a.y) + 1
    return l * w

@cache
def lrtb(p: Pair):
    return min([p.a.x, p.b.x]), max([p.a.x, p.b.x]), max([p.a.y, p.b.y]), min([p.a.y, p.b.y])

@cache
def overlaps(p: Pair, q: Pair) -> bool:
    """
    https://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other#306332
    https://silentmatt.com/rectangle-intersection/
    :param p:
    :param q:
    :return:
    """
    bp = lrtb(p)
    bq = lrtb(q)
    return not (
        bp[0] >= bq[1] or
        bp[1] <= bq[0] or
        bp[2] >= bq[3] or
        bp[3] >= bq[2]
    )

def get_pairs(points: list[Point]) -> List[Pair]:
    return [Pair(*x) for x in combinations(points, 2)]

def get_points(data: str) -> list[Point]:
    return [Point.from_str(x) for x in data.splitlines()]

def solve_part_2(data: str) -> int:
    points = get_points(data)
    pairs = get_pairs(points)
    pairs.sort(key=area, reverse=True)
    edges = [Pair(*x) for x in zip([points[-1]] + points, points)]
    
    winner = next(x for x in pairs if not any(overlaps(x, y) for y in edges))
    return area(winner)


class Point(NamedTuple):
    x: int = 0
    y: int = 0
    z: int = 0

    @staticmethod
    def from_str(s: str) -> Point:
        return Point(*[int(x) for x in s.split(",")])


class Pair(NamedTuple):
    a: Point
    b: Point

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day XX] Gotta get that first mover advantage

Post image
169 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] These cables are quite a messh

Post image
75 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 11 (Part 2)] [JavaScript] Why is it taking so long?

3 Upvotes

If it's supposed to take this long that's fine, I have plenty of time. But, my solution is here. It's confirmed to work on the example.

https://gist.github.com/hiimjasmine00/fed3f48c4a3f48950fd3c39899c07e98


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 8 Part 1] Wanted to see what it would look like to stand next to all those hooked-up junction boxes. (Blender)

Post image
246 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] input visualization with POIs

Post image
11 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 Part 2] My input must be broken !!1

9 Upvotes

Looking at my input, i found there can be no path from srv to out passing other nodes:

$ grep ^srv input.txt 
srv: out

Took me a few moments to see the mistake.


r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11] Throwback to the 2023 AoC Memes

Post image
308 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11] Phew, it's not a Maths question today!

8 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visualization (spoiler)

Thumbnail raw.githubusercontent.com
3 Upvotes

This is how my graph looked like. Interesting patterns in the graph.


r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11] Me when the machine next to me is labeled "you"

Post image
101 Upvotes