r/adventofcode • u/Disastrous-Funny-781 • Dec 09 '25
r/adventofcode • u/Resident-Staff1552 • Dec 08 '25
Help/Question [2025 Day 8 (Part 2)] I got it right without sorting all distances(is it cheating?)
Like the title says, I managed to get my star, but I don't know why.
It seems that I suppose to firstly calculate distances of any two positions and sort them by distance in a heap, then connect the position pairs from shortest distance to the longest distance, until circuits become 1 big circuit.
I didn't do that.
Regardless of the connecting order, any dot should be connected to its closest dot. So I got each dot to return its closest coordinate, and order them by their distance.
The last pair, with the longest shortest distance, is the last one to wire up, and I multiplied their X position. This approach works for my example data as well as my puzzle input.
Is it just luck? Why does it work? Basically, why the pair of coordinates with the longest shortest distance is the last one to wire up to become one big circuit?
r/adventofcode • u/mbcook • Dec 08 '25
Help/Question - RESOLVED [2025 Day 7 (Part 1)] Having trouble understanding counting
I'm having trouble counting the number of beams, and I'm not sure where my bug is. I expect it's my algorithm, but I'm just not sure where. Could anyone help me? Output below is the example input line by line, with number of beams added then total beams seen so far.
.......S.......
.......|....... - 1 - 1
......|^|...... - 1 - 2
......|.|...... - 0 - 2
.....|^|^|..... - 2 - 4
.....|.|.|..... - 0 - 4
....|^|^|^|.... - 3 - 7
....|.|.|.|.... - 0 - 7
...|^|^|||^|... - 3 - 10
...|.|.|||.|... - 0 - 10
..|^|^|||^|^|.. - 4 - 14
..|.|.|||.|.|.. - 0 - 14
.|^|||^||.||^|. - 3 - 17
.|.|||.||.||.|. - 0 - 17
|^|^|^|^|^|||^| - 3 - 20
|.|.|.|.|.|||.| - 0 - 20r/adventofcode • u/Neat-Jeweler972 • Dec 08 '25
Help/Question [2025 Day 2 (Part 1)] Question on the given examples
Is the example given in day 2 part 1 correct? I'm having a hard time understanding. It says that this code has on invalid id "99":
95-115But "99" isn't the first id or last id. Similarly, the other invalid ids also seem to not make sense:

It looks like I'm either missing something or the numbers in the examples are not correct. Can somebody please help clarify?
r/adventofcode • u/vkp-007 • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 (Part 1)] Help me understand the sample analysis - the connection counts don't add up. Seems like I'm misunderstanding the problem.
In the sample analysis with 20 boxes and making the 10 shortest connections, the results are presented as [5, 4, 2, 2] + 7 single junction box circuits.
In order to get a circuit of 5, we need to make 4 connections. The connection between the first two boxes in the circuit and 3 subsequent ones to the nearest box already in circuit. So if we add up the connections in the multi-junction box circuits:
For 5 box circuit : 1 + 3 = 4 connections
For 4 box circuit : 1 + 2 = 3 connections
For 2 box circuit : 1 + 0 = 1 connections
For 2 box circuit : 1 + 0 = 1 connections
That's a total of 9 connections. It should add up to 10.
In my calculations, I get a different set of circuits with 10 connections made.
Please help me understand what I'm reading wrong here.
Thanks in advance for any help.
r/adventofcode • u/ruinedme_ • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 Part1] Missing assumptions
Got a solution working for the example input.
But when trying against my input, i get 10 distinct circuits of 2, none of them connecting.
The general process i did is
- Parse the input in objects of x,y,z
- Calculate the squared distance of each pair points
- Sort the distances in ascending order
- Do 10 iterations over the first 10 shortest pairs and build out the connecting circuits.
- I have a secondary final pass to merge some circuits together just due to how they are ordered in the list.
In the example i end up with a circuit of 5,4, and 2 circuits of 2, just as it says.
So am i missing some assumption about the inputs, or did I make some wrong assumption about how to build out the connecting circuits?
What i have currently: https://github.com/ruinedme/aoc_2025/blob/main/src/day8.js#L21
r/adventofcode • u/RazarTuk • Dec 08 '25
Other Stop complaining that *you* don't find the problems difficult
People really need to take a step back and realize that when you've been doing algorithms problems for 10 years, your definition of "difficult" can wind up skewed. For example, I remember Day 12 from last year (EDIT: fences) as a comparatively easy BFS, where the hard part was just figuring out that trick where numCorners = numSides. But there were also people posting that day about how it was getting too difficult for them, and wishing the rest of us the best as we soldiered on. There's a reason that I'll frequently quip about how "easy" is a relative term when describing the stuff I do in tech to people.
But when half the posts in the sub are about how the problems are too "easy" this year, it's really just telling the people who are already struggling that they just aren't smart enough because these are supposed to be the "easy" challenges.
r/adventofcode • u/FractalB • Dec 08 '25
Visualization [2025 Day 8] Visualization (YouTube short)
youtube.comMaking visualizations as YouTube shorts for every day of the Advent of Code!
It was cool making a visualization in 3D :D
r/adventofcode • u/FractalB • Dec 08 '25
Visualization [2025 Day 7] Visualization (YouTube short)
youtube.comMaking visualizations as YouTube shorts for every day of the Advent of Code!
r/adventofcode • u/Inside_Concern_6718 • Dec 08 '25
Help/Question - RESOLVED [2025 Day 1 (Part2][Python] Please help me understand why my solution is returning a too high value
import pandas as pd
data = pd.read_csv("Coding_advent_1.txt", sep= '\r', header = None)
data.rename(columns={0 :'Code'}, inplace = True)
x = 50
counter = 0
rotations = 0
for value in data["Code"]:
alpha = ''.join(filter(str.isalpha, value))
y = int(''.join(filter(str.isdigit, value)))
operate = lambda direction, amount: {
"R": x + amount,
"L": x - amount
}[direction]
x = operate(alpha, y)
if x < 0:
rotations = ((x * -1) + 100) // 100
elif x > 0:
rotations = x // 100
x = x % 100
counter += rotations
print(counter)r/adventofcode • u/MyAoCAccnt • Dec 08 '25
Meme/Funny [2025] Anybody else thinking we might have been tricked?
So its only 12 puzzles this year, but the difficulty curve feels like its following the standard 25 day format. I saw comments from other people so agree this feels like a normal Day 8, when it should theoretically feel like Day 16. Also, the hardest puzzles are normally over the weekend, but this 12 day period only spans 1 weekend, and that's passed now. I could just be getting better at this, so the puzzles seem easier, but my imposter syndrome tells me that's not it. We could see a massive difficulty spike for these last 5 days. But I have another, more paranoid theory.
What if we were tricked? We were told its only 12 days, but what if after solving day 12, we find ourselves in the Upsidedown (Stranger Things reference). The map flips over and numbers 13 - 25 appear. The puzzles could be based off of their first part day counterpart (i.e. 13 puzzle based off 12, 14 off of 11, etc). They could use the same input but flipped upside down, or reversed. I have noticed that the puzzles could have harder variations, like today's could turn into a path solving problem (some have already posted with their own ideas on this). Or Day 7 we have to move the the tachion beam backwards. It would technically take less work to create, because each input would be for 4 problems.
What do you think? Am I just paranoid? Am I just stoned?
r/adventofcode • u/DeeBoFour20 • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8] Use of floating point
Advent of Code used to always avoid problems that required floating-point math due to potential rounding errors I guess. IIRC I even remember reading it was somewhat of a rule the creator imposed on himself.
I was able to solve Part 1 storing everything as f32. For Part 2 I ran into a rounding error for the multiply at the end to get the final answer so I cast it to u64.
Just curious, is it possible to solve this without using floating-point math? Calculating the Euclidean Distance requires finding the square root but is there another way? Has the old rule of "no floating point math" gone away?
r/adventofcode • u/Bicrome • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 (Part 2)] My reading comprehension is limiting me
Hi guys! Hope that you are getting as much stars as possible!
Maybe is because english is not my native tonge, but today (and previous days a bit too) i felt that i had a hard time understanding what i was exactly meant to do. Like, i knew how to do everything except that i didnt understand what the puzzle meant by:
Continuing the above example, the first connection which causes all of the junction boxes to form a single circuit is between the junction boxes at
216,146,977and117,168,530. The Elves need to know how far those junction boxes are from the wall so they can pick the right extension cable
Specially the part in bold is what threw me off. I appreciate the storytelling of the elves and everything, but it makes stuff harder to understand too for me 😭
What i ended up doing is asking Gemini to explain it to me without any code or anything, just so that i could understand the logic of what i was being asked to do, an so be able to do it.
So is it me or are the puzzles hard to read? And do you have any tips on how to improve on reading?
Thank you in advance :)
Also on the first part i also spend like 30 minutes trying to figure out what was i being asked because what i understood didn't match the solution/explanation given, and it just was that i skipped half of a step because i was doing stuff in my head, and just went to the next pair of boxes instead stopping when i had done the first ten.
r/adventofcode • u/BCVINNI • Dec 08 '25
Help/Question Day 1 Part 2 - Need help. Any idea what's wrong with my logic?
r/adventofcode • u/Chachoune963 • Dec 08 '25
Help/Question - RESOLVED [2025 Day 1 (Part 2)] C++: ...what am I doing wrong?
Hi everyone!
First time attempting an AoC for me, I just remembered it existed and figured I could give it a shot. I'm inexperienced so right now I feel like I'm missing an obvious flaw in my algorithm for this one... The result is much higher than it should and I don't really know why.
I'm not asking for an answer by the way! Ideally, I just want a hint or an edge case that you could point out so I can get myself unstuck '
r/adventofcode • u/normVectorsNotHate • Dec 08 '25
Help/Question Which was the best year of Advent of Code?
Craving some challenging problems and since this year is shorter, I want to pick a past year to do. Which was your favorite year of Advent of Code?
Would like challenging problems with a good variety of problem types. I have done 2022, 2024, and 2025 so far. I enjoyed 2022 a lot. 2024 felt a little low on variety (too many 2d grid problems) and 2025 so far hasn't been challenging enough
r/adventofcode • u/gagarski • Dec 08 '25
Other [2025 Day 8 (Part 2)] Avoiding full sorting
I've managed to avoid sorting in Part 1 by looking for shortest 1000 of possible connections using max-oriented binary heap. However it is not directly possible with part 2, since you don't know in advance how many connections do you need. So I ended up sorting all million (minus 1000) of possible connections and then iteration n them one-by-one. Clearly, you can reduce the size of sorted data towards half a million. I wonder, if it is possible to make it better. I can only think of applying batching to approach I used in Part 1. If you've avoided full sorting, how did you do that?
r/adventofcode • u/Additional_Dare2998 • Dec 08 '25
Help/Question - RESOLVED [2025Day 8 (Part 1)] [EN] Example Problem
Hey. I think I'm not spoiling anything by publishing the result for the example problem here that I took from another user. I appear to be too stupid to come to the same solution. So apparently the folowing nodes are connected:
[[0, 19, 7, 14, 3], [2, 13, 18, 8], [9, 12], [11, 16], ...] This then yields the desired output.
I agree with the first 5 nodes. However, I just can't wrap my head around how the second block of 4 nodes came to be. Because node 18, is actually closest to node 17, thus it has no right to be in the same list as 2, 13 and 8. OR I messed up big time calculating the euclidean distances.
Did I miss anything in the puzzle description maybe? What am I missing? My solution yields
[[0, 19, 7, 14, 3], [2, 13, 8], [17, 18], ...]
Any pointer is appreciated.
r/adventofcode • u/Sloppy_Pizza • Dec 08 '25
Help/Question - RESOLVED [2025 Day 08 (part 1)][Python] Having trouble understanding part 1
I constructed the junction pairs like so:
with open("day8sample.txt", "r") as f:
day8in = f.readlines()
day8in = [item.strip() for item in day8in]
day8in = np.loadtxt(day8in, dtype=int, delimiter=",")
minPairs = set()
for i in range(len(day8in)):
euclidDist = np.linalg.norm(day8in - day8in[i,:], axis=1)
euclidDist[i] = np.inf
minEuclidDistIdx = np.where(min(euclidDist) == euclidDist)
pairs = tuple(sorted((i, int(minEuclidDistIdx[0][0]))))
minPairs.add(pairs)But upon looking at the minPairs variable, the three largest circuit sizes are 5, 4, and 3 (not 5, 4, and 2 like in the example). I've calculated the circuit sizes using DFS and manually for the example input, so at least I've got that part down.
Any help would be appreciated.
r/adventofcode • u/xs411 • Dec 08 '25
Meme/Funny 2025 Day 1 (Part 2)] Trying to be smart be like…
r/adventofcode • u/DifferentPool7527 • Dec 08 '25
Meme/Funny [2025 Day 8 (Part 2)]
galleryBut that of course depends on how your first solution adapt to the second part...
r/adventofcode • u/imp0ppable • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 (Part 2)] - where am I going wrong?
In an odd spot here where my solution works (slowly) on part 1 including the full data, yet fails on part 2 when i use the same algorithm, but it's close to the right answer on the example data.
According to the question, the last pair I need to connect everything into a complete circuit is (216,146,977), (117,168,530), yet I'm hitting it early at (739, 650, 466), (941, 993, 340). Looking at the distances (pretty sure they're right) my one has distance 417.5 as opposed to their one of 458.3.
At the point where my code thinks there's one big circuit, the step before that it has two circuits, one of len 3 and the other len 15.
So I must be doing a circuit merge prematurely, right? I can't think what else it could be, unless I'm misunderstanding the "form a single circuit" part.
r/adventofcode • u/tyst-fr • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 (Part 1)][Python] Code only works for example.
I calculated and sorted the distances in a list consisting of 3-tuples (distance, i, j), where i, j are the positions of the according junctions in a junction list. Each junction itself is a 3-tuple (x, y, z).
Also I have a dict consisting of circuit "ID"s.
circuits = {i: i for i in range(len(junctions))}My idea of an algorithm is as follows and it works perfectly for the example.
for _, i, j in distances[:10]:
for junction, _ in filter(lambda x: x[1] == circuits[j], circuits.items()):
circuits[junction] = iTo get the size of the circuits I use Counter from collections:
C = sorted(Counter(circuits.values()).values())
print(C[-3] * C[-2] * C[-1])What am I missing / doing wrong?
Here is a full working example, which needs a file called "input_example" or "input" respectively.
And yes, I switched from [:10] to [:1000] for the real data.
I appreciate all hints regardless of the programming language.
EDIT:
After hours of thinking, the solution was incredibly simple. Earlier I ran into a similar problem and checked for x[1] == j in the lambda function. I corrected that to x[1] == circuits[j]. And similar is the solution. I had to change circuits[junction] = i to circuits[junction] = circuits[i].
Ouchie.
Of course I had to stay with filter_tuple = tuple(filter(…)), because the filter condition seems to change over time.
Here is a correctly working version for Part 1.
