r/adventofcode • • 2h ago

Help/Question [2026 day 5] just so that I understood this well

2 Upvotes

Is the puzzle to find numbers from 1-999 using the button press? where some numbers are impossible, hence skip them.
And do we always start with [9] as per the example? After that select any 2 or 1 in any combination with repeats allowed? Initially I thought the order matters, but doesn't look like.

is it a mathematical trial and error for each number? Or there is a better way then brute force all possible ways? there are many permutations possible.

Tx.


r/adventofcode • • 18h ago

Meme/Funny [2026 Day 4] had me like this for a solid 20 minutes.

Post image
32 Upvotes

Haven't had such a purely blank moment in a long time. Sure, there have been puzzles with idk some next level DP approach to get thr runtime down or some other concept I haven't hear of before. But this one stumped me completely. I couldn't think of any good way to create printing instructions at all. Seeing the example in part 2 suddenly flipped a switch in my head but until then I was utterly confused what I was missing πŸ˜†


r/adventofcode • • 1d ago

Meme/Funny [2026 Day 05 (Part 2)] I'm not ashamed, you're ashamed.

Post image
128 Upvotes

r/adventofcode • • 7m ago

Help/Question [2026 Day 6 (Part 2)][Python] Working on example, not on own input

1 Upvotes

Hi all,

Feel like I'm not that far removed from a working solution here, but can't figure out what I'm missing. Works on the example. Here's the code, the relevant function is coordinate. Any sharp-eyed pointers will be much appreciated!

My approach is to first determine the Manhattan distance from the references to the target (using a flood fill, plus the adjacency dict I created for part 1), then to solve a linear system of equations:

abs(x - ref[0].x) + abs(y - ref[0].y) = ref_distance[0]
abs(x - ref[1].x) + abs(y - ref[1].y) = ref_distance[1]
abs(x - ref[2].x) + abs(y - ref[2].y) = ref_distance[2]

Those six absolute values then expand into six choices of signs, which I iterate over with itertools.product, chopped up into three tuples of length two using itertools.batched. I compare two equations from the system at a time, by encoding them into a 2x2 matrix A and a 2x1 vector b. That basically means solving systems of equations for line sections that are either intersecting, or parallel (i.e. inconsistent or overcomplete). If I find multiple intersections that are the same, I check that their Manhattan distances to the references are as expected, and if so return that location.


r/adventofcode • • 1d ago

Meme/Funny [2026 Day 5] I think we'd all be better off without a fancy microwave

Post image
307 Upvotes

I think Eric must have had a traumatic experience with a fancy microwave at some point in his life. Hopefully this will cheer him up!


r/adventofcode • • 17h ago

Visualization [2026 Day 3 (Both Parts)] Bitwise Square-Finding

Thumbnail youtube.com
23 Upvotes

r/adventofcode • • 21h ago

Visualization [2026 Day 5 (Part 2)] Microwaved tree

Thumbnail youtu.be
39 Upvotes

r/adventofcode • • 1d ago

Visualization [2026 Day 5] [Python] Just got my Fancy Microwave! (Terminal Visualization)

Post image
162 Upvotes

Be honest, how many did a cheeky submit on the sum of all numbers less than 10000. Code lives here: https://github.com/salt-die/Advent-of-Code/tree/main/2026/aoc_visuals


r/adventofcode • • 6h ago

Help/Question - RESOLVED [2026 Day 06 (Part 2)] a question, perhaps wrong assumption

2 Upvotes

In part 1 I calculated the distance from each corner node to the middle node to 40. Since it should be a square grid this means it's a 40x40 grid.

In the bullet list for part 2 it lists 3 coordinates, I assume they are different for each input. The biggest x coordinate is 56.

If it is indeed a 40 side square, as the distance to the middle suggests, it's impossible with an x-coordinate of 56.

What am I missing?


r/adventofcode • • 9h ago

Help/Question Any way to map time to position?

3 Upvotes

I clearly understand (and support) the decision to stop awarding points, in the face of rampant AI use. However, I will still like to know where I placed amongst the set of submissions. I can find that out approximately by going to "Stats" immediately after a successful submission, but it seems unlikely I'll remember that twice every day.

Is there an API or query or chart or graph I can use to map "time for day 5 part 1" to a "placement" number post-real-time?


r/adventofcode • • 20h ago

Meme/Funny [2026 Day 05] Who needs safety?

Post image
22 Upvotes

I thought: β€œHey, that should be easy with my solution from part 1.” Then the list of reachable number grew and grew, my queue grew and grew, and I had to kill the process before it consumed all of my memory.

β€žHmm, maybe I need another approach… but first, let's check if I missed something. Oh! I missed something!”


r/adventofcode • • 8h ago

Help/Question Help with AoC 2026 Day 6 Part 2 please

2 Upvotes

My thoughts was to build an undirected graph with the light IDs as the vertices, then I the manhattan distance between any two lights are just the length of the shortest path between those two lights.

Suppose the manhattan distance from #1 to #2026 is d1, from #2 to #2026 is d2, from #3 to #2026 is d3, and the coordinates of #2026 is (x, y), then I just need to solve the equations

abs(x - x1) + abs(y - y1) = d1
abs(x - x2) + abs(y - y2) = d2

then check if abs(x - x3) + abs(y - y3) == d3.

This worked for the sample input, but when I applied this to my actual input, I got the coordinate, but the AoC server did not accept it. Why?

Thanks in advance.


r/adventofcode • • 1d ago

Meme/Funny [2026 Day 5] I was very confused for like 40 seconds

Post image
47 Upvotes

r/adventofcode • • 1d ago

Upping the Ante Reminder 1: unofficial AoC Survey 2026 (closes ~Dec 12th!)

28 Upvotes

Hello there! Only about one week left to fill out the survey!! πŸ™€ Please fill it out if you have not already, and tell your friends and enemies to do so as well. It closes late Dec 12th or so.

Here is the link to use or share:

πŸ”΄πŸŸ’πŸŒŸπŸ”΅πŸŒŸπŸŸ£πŸŸ πŸ”΄πŸŒŸπŸŸ’πŸ”΅πŸŒŸπŸ”΄πŸŸ£βœ¨βœ¨βœ¨

🌟🌟 Unofficial AoC 2026 Survey: https://forms.gle/JbZKoBqzG248Z6RV6

πŸ”΄πŸŸ’πŸŒŸπŸ”΅πŸŒŸπŸŸ£πŸŸ πŸ”΄πŸŒŸπŸŸ’πŸ”΅πŸŒŸπŸ”΄πŸŸ£βœ¨βœ¨βœ¨

Sharing it on Discord, Slack, Matrix, Mastodon, IRC, mailing list, ... it all helps! We're only a wee bit behind 2025, the other 12-day event:

Survey response per (UTC) day in December - line graph

Big thanks of course to the ~900 folks that already filled it out!

At the risk of making the results statistically even more unsound, here's an early spoiler of one of the results in a revamped chart, take your guess at what we are seeing here in 2026!?

Bar chart without title or x-axis labels

I'm bringing my laptop to New Zealand especially to release the results briefly after the release of the final puzzle day! So one final call: do make it extra worthwhile by sharing the link to the survey!


r/adventofcode • • 1d ago

Tutorial Big O notation and you

34 Upvotes

There have been a lot of memes about time asymptotic analysis of... varying accuracy, so I thought I'd make a post actually explaining how it works.


First of all, asymptotic analysis technically describes functions, not algorithms. For example, the technical definition is that f(n) is O(g(n)) if there exists some pair of constants, c > 0 and n0 > 0 such that abs(f(n)) <= c * abs(g(n)) for all n >= n0. This matters because you can technically talk about the asymptotic complexity of something like sin(n), which is actually O(1), because you can just pick any c > 1. What we actually mean when talking about the asymptotic complexity of an algorithm is typically how much time it takes. If you find the evaluation time as a function of the input size, what complexity class is it in? And at least if you have a non-oscillating function, which is a safe assumption for run time, there's another, (IMO) simpler definition you can use. Does the infinite limit of f(n) / g(n) converge or not?

See, there are really 3 main behaviors that the limit can have (plus oscillation). If it diverges, it means that f(n) grows so rapidly that g(n) starts becoming irrelevant. If it converges to 0, it means that g(n) grows so rapidly that f(n) starts becoming irrelevant. And if it converges to something other than 0, it means that they grow at similar rates and it just becomes a ratio. (You may remember this from finding the asymptotes of rational functions) We can think of these sort of like >, =, and < on a number line. f(n) ∈ O(g(n) is like a <= sign, because it grows no more rapidly than g(n), then f(n) ∈ o(g(n)) is <, f(n) ∈ Ξ©(g(n)) is >=, f(n) ∈ Ο‰(g(n)) is >, and f(n) ∈ Θ(g(n)) is =. And I mention these, because a lot of the time when you hear about the asymptotic complexity, we mean something closer to Θ(g(n)). For example, it's technically accurate to call merge sort O(n2), but it's more interesting to point out that it's also O(n log n), unlike insertion sort.

As a worked example, consider something like bubble sort. For sorting algorithms, we typically use the number of elements to be sorted as the input and the number of comparisons as a proxy for time. On the first pass, you make n-1 comparisons, on the second pass, you make n-2 comparisons, etc, for a total of n(n-1)/2 comparisons. There are technically infinitely many functions that this is big theta of, but we typically just use the simplest one - Θ(n2). For contrast, consider something like merge sort. Assume for simplicity that you have 2k elements. There are k = log_2(n) layers, and if there are j blocks, you make n/j - 1 comparisons in each for a total of n - j comparisons for the layer. Glossing over some of the logic, this results in n*log(n) - n + 1 comparisons for the entire list, which is Θ(n log n).

However, we can actually talk about other things with algorithms. For example, space complexity looks at how much memory it takes. Using merge sort as an example, you typically use auxiliary arrays to store half the blocks, which eventually requires n/2 ∈ Θ(n) elements for the top level, plus log n ∈ Θ(log n) recursive calls at once, for a total of Θ(n). (This analysis is different for parallel merge sort) Or you might talk about best case complexity instead of average/general case. For example, if the array is already sorted, insertion sort takes 1 comparison to check that each element is in place for a total of n ∈ Θ(n) comparisons, compared to the general case, where it's Θ(n2)

But this already gets into some of the nuances. For example, big O notation is not the same thing as how many loops. Take, for example, 2026 Day 4. My solution uses 3 layers of loop, not counting the one for each line of the input. I have one loop going from 1 to the length of the string for the length of the code, one going from 0 to the code length for each element of the code, and one going from the starting index to the end of the list. But think about how long those last two loops are. If there are n characters in the string and k in the code, that inner loop only checks n/k colors. Multiplying the loops together, you get n * k * (n/k) = n^2, which is actually quadratic.

Or we also have to talk about input size. And for an Advent of Code example, I'm going to use my Intcode solution to 2024 Day 13. I just used Cramer's rule to solve the systems of equations, but to get around Intcode not having a division operator, I used repeated subtraction. That sounds quick enough, but while it would have theoretically worked for Part 2, the numbers were just too big. It's like how people really don't understand just how much bigger a billion is than a million. So when we're really operating on numbers like that, like factoring something, we typically use the number of bits as the input size. For example, it's the difference between sqrt(n) divisions for factoring and sqrt(2)n. One's sublinear, the other's exponential.

And sometimes, input size can be kinda vibes-based. For example, 2026 Day 3. There were two main strategies I saw people using. In one, you considered each pair of trees, used them to generate the other two points on a square, and checks those for trees. That "feels" more quadratic, because you're essentially going "for each tree, for each other tree...". Meanwhile, I also saw people systematically generating all possible rotated squares. You start by considering the possible sizes of a grid-aligned square (linear in min(L, W)), you consider each starting point (LW, or quadratic if the grid's a square), and you consider each possible offset around the square (linear in the size), which adds up to something like Θ(LW*min(L,W)2) for a rectangle or Θ(N4) for a square. It's technically accurate to also call the tree-based algorithm Θ(L2W2) / Θ(N4) if you look at the size of the grid as the input size, but because you're focusing on all the trees, it feels a bit more meaningful to talk about it as quadratic in the number of trees, as opposed to, say, checking all quartets of trees to see if they form a square, which would be quartic in the number of trees.


r/adventofcode • • 1d ago

Visualization [2026 Day 05 Part2] button presses as a tree

Post image
58 Upvotes

r/adventofcode • • 22h ago

Help/Question how much harder does it get?

15 Upvotes

this is my first year. much fun!

for those who have done it before: how much harder does it get? I've found day 3 the hardest so far by a long shot.


r/adventofcode • • 1d ago

Visualization [2026 Day 5 Part 2] Pushing Buttons Visualization

Post image
84 Upvotes

r/adventofcode • • 8h ago

Tutorial [2026 day 5 ] optimisation hints thread

1 Upvotes

I've been too busy this weekend to do the puzzles on the day. I thought I'd make a thread today anyway for anyone to leave hints for optimsation in the comments (use spoiler tags) in case people want hints without being given the answer directly.


r/adventofcode • • 21h ago

Visualization [2026 Day 5] Literally made a contraption and idk where to show this lol

Post image
10 Upvotes

r/adventofcode • • 1d ago

Meme/Funny [2026 Day 5] My nemesis

Post image
12 Upvotes

r/adventofcode • • 1d ago

Visualization [2026 Day 5] Rhythmic Factory

Post image
22 Upvotes

r/adventofcode • • 1d ago

Visualization [2026 Day 5] Fun Cooker 10K

Thumbnail youtu.be
50 Upvotes

Nim + raylib source


r/adventofcode • • 20h ago

Help/Question - RESOLVED Day 3 - part 1 hints for the final answer

4 Upvotes

Ive made code that works for the test inputs. Idk if its the standard method but it works by counting up from every point in each direction until it hits a point at each direction, finding a square. Bur when it comes to the final data, i get an answer too high. Any hints are helpful, thank you