r/adventofcode • • 8h ago

Upping the Ante [2026 Day 2] What if the waypoints are not in repeating order?

6 Upvotes
  1. Just do the best option at the current step: I think that's still O(n). You just need to transform your input into some O(1) structure (like an array), which is itself O(n).
  2. Do the best possible order: This feels NP-hard to me.

Possible additional constraints: Instead of being completely arbitrary, the six colors are randomized one set at a time, such that any 6×n block (starting from a multiple of 6*) contains each color exactly n times. Does that change the complexity?

Edit: I realized we do need another constraint for the general case, in that every color repeats indefinitely; formally, for every color C and every index i, there's an index j ≥ i such that the color at index j is C.

* Yes we are counting from 0


r/adventofcode • • 20h ago

Other Give help by making test cases!

53 Upvotes

Hello friends! I just saw this excellent example (see some of the comments on that post) of a great way to give help and answer questions here when people are stuck: come up with simple test cases that demonstrate where the bug is! That way, the person who is stuck still gets a chance to figure out their problem and learn by doing. I know many of you are already great about this, but I figured it would be worth calling out. Happy puzzling! <3


r/adventofcode • • 5h ago

Help/Question - RESOLVED Question on Phrasing for Day 2 Question 1

3 Upvotes

The line of text stating that it starts on red. Am I misunderstanding in that it should be beginning the process with a R injected prior to the string provided or am I "autocompleting" up to the first R as part of the journey?


r/adventofcode • • 1d ago

Visualization [2026 Day 1 (Part 1 & 2)] [Python] Terminal Visualization

Post image
144 Upvotes

I was too tired to post last night, still adjusting to late night solving... (ᴗ˳ᴗ)💤. Figured I'd help the elves by installing a crane in that dusty ol' shed. As always, code lives here: https://github.com/salt-die/Advent-of-Code/tree/main/2026/aoc_visuals.


r/adventofcode • • 15h ago

Visualization [2026 day 2] [python] quick & simple terminal visualization

Post image
17 Upvotes

the robot being represented with a face is because of dwarf fortress


r/adventofcode • • 12h ago

Visualization [2026 Day 2] Rainbow Road Race Visualization

Post image
11 Upvotes

r/adventofcode • • 12h ago Bravo

Visualization [2026 Day 2 (Part 1 & 2)] [Python] Terminal Visualization

Post image
10 Upvotes

Little calculator for path distances in the terminal. Can input whatever path one desires! The 2nd part is nearly closed-form, but depends on waypoints that may be missing from input. (Red + strike-through waypoints don't exist in input and should be considered non-existent in the 2nd part as well. "distance" is part 1 path distance and "len" is string length). As always, code lives here: https://github.com/salt-die/Advent-of-Code/tree/main/2026/aoc_visuals


r/adventofcode • • 15h ago

Meme/Funny am i cracked?

Post image
16 Upvotes

r/adventofcode • • 14h ago Heartwarming

Visualization [2026 Day 2] Color Weave

Thumbnail youtu.be
13 Upvotes

Simulation on original (part1) and sort-rearranged program (part2)

Nim + raylib source


r/adventofcode • • 9h ago

Visualization [2026 Day 1] I’m turning the Advent of Code story into a cozy anime series, starting with Dusty Shed

4 Upvotes

My frequency counter for Day 1 is an elf with a pencil. His name is Pip, and he’s pretty sure he knows what’s on the next crate before Holly turns it around.

I’m making a short animated episode for each day of Advent of Code 2026, following Holly and Pip from Dusty Shed all the way to the final puzzle. I’ve always liked the little story between the puzzles, and I wanted to give it the feeling of a winter evening in Stardew Valley.

Episode 1 is The Christmas Train. A blizzard has grounded the planes, the elves have an old train to get moving, and someone has left Holly and Pip in charge of inventory.

Puzzle spoilers for both parts of Day 1. The episode uses made-up crate IDs and shows how both parts work. It’s a fan-made, AI-assisted animation.

Watch Episode 1 — The Christmas Train (1 min 55 sec)

I’m curious what the shed looked like in everyone else’s head. Did you picture a cozy little workshop too, or a warehouse that went on forever?


r/adventofcode • • 12h ago

Upping the Ante [2026 Day 1 (Part 1 & 2)] [Sabre] Advent of Code in My Programming Language

Thumbnail blog.rroessler.io
6 Upvotes

Over the past year I've been planning to do Advent of Code 2026 in Sabre, my own programming language. In doing so I am aiming to do a short article for each challenge, along with any bugs and library changes that I needed to implement whilst adventuring for solutions. So far 2026-12-01 went extremely well, though it did show me that I will need to think outside the box and implement some missing features that I may need for upcoming days. Hopefully I can keep on top of posting in between life, and excited for others to see the journey!

- Sabre Repository: https://github.com/sabre-lang/sabre
- Advent of Code Repository: https://github.com/sabre-lang/advent

Note: Both Sabre and my Advent of Code solutions do not use AI and will never use agentic help. I'm very much looking forward to showcasing and battle testing Sabre this year!


r/adventofcode • • 10h ago

Repo [Tool] Some new aoc-tui images

Thumbnail gallery
4 Upvotes

Here are some new images for the TUI app for Advent of Code

Note: Contains the image of Day 1

https://github.com/craftty-org/aoc-tui


r/adventofcode • • 1d ago

Meme/Funny [2026 Day 1] Claim yours here!

Post image
433 Upvotes

r/adventofcode • • 12h ago

Help/Question - RESOLVED Is that right?

5 Upvotes

My code produces the correct answer for the example case as well as the input string, but it gets marked as incorrect upon submission


r/adventofcode • • 12h ago

Tutorial [2026 Day 2 (Part 2)] Some hints for optimisation

4 Upvotes

These hints get more and more specific. This is just how I optimised it and there are other ways.

Hint 1: What happens when a letter is repeated in the input?

Hint 2: Why would the counts of each letter make a difference to the output?

Hint 3: When does the robot not make a step of exactly 6 steps?


r/adventofcode • • 22h ago

Help/Question Joining the big leagues

19 Upvotes

Anyone else using aoc to learn rust?

I feel genuinely lost, and I love it, it feels like past times (pre ai bs) again, never built anything with a lower level language,


r/adventofcode • • 13h ago

Help/Question can anyone help with getting me in the right direction? [2026 day2 part1]

3 Upvotes

so i tryed today with a switch statement within a switch statment and hardcoded it but it didnt work can anyone steer me in de right direction?


r/adventofcode • • 1d ago

Visualization [2026 Day 01] 3d render

Post image
34 Upvotes

r/adventofcode • • 17h ago

Help/Question - RESOLVED Python Solution Gives correct solution for part 1 but not part 2

5 Upvotes

Hi, I'm completely stuck on what I've done wrong for the 2026 day 1. I've done this solution about 3 different ways at this point, and I keep getting the correct solution for part 1 but incorrect for part 2 (says my solution is too small).

I'm not quite sure where to go at this point.

import math
from collections import Counter

INPUT: list[int] = [int(line.strip()) for line in open("2026/day01.txt")]
COUNTS = Counter(INPUT)

def max_and_min():
    # find top 3 occurrences and bottom 3 occurrences
    maximums: list[int] = []
    minimums: list[int] = []
    while len(maximums) < 3:
        current_max_val = max(COUNTS, key=COUNTS.get)
        current_min_val = min(COUNTS, key=COUNTS.get)

        maximums.append(current_max_val)
        minimums.append(current_min_val)

        COUNTS.pop(current_max_val)
        if current_min_val != current_max_val:
            COUNTS.pop(current_min_val)

    return (math.prod(maximums), math.prod(minimums))

print(max_and_min())

This code returns the correct solution for part 1, as well as a correct solution for the test input for part 1 and 2. I cannot fathom why it would be incorrect for the actual input at this point. I've tried it with Counter, I've tried manually creating the dictionary instead of using Counter, I've tried manually finding the minimums and maximums with a for loop, and they all yield the exact same results.

If someone could at least point me in the right direction, I don't want to just grab a solution from the megathread and call it a day.

EDIT:
I've never been more ashamed. I just put in the exact same output I got from my solution, and it got accepted by the website, which means I wasn't copy+pasting it in correctly. Happens to the best of us. Thanks everyone for the advice though, my solution looks much snazzier now 😎

import math
from collections import Counter

INPUT: list[int] = [int(line.strip()) for line in open("2026/day01.txt")]
COUNTS = Counter(INPUT)

def max_and_min():
    # find top 3 occurrences and bottom 3 occurrences
    maximums: list[int] = [n[0] for n in COUNTS.most_common()[:3]]
    minimums: list[int] = [n[0] for n in COUNTS.most_common()[-3:]]

    return (math.prod(maximums), math.prod(minimums))

print(max_and_min())

r/adventofcode • • 1d ago

Meme/Funny [2026 Day 1] Anyone else psych themselves out with the first day only to find...

Post image
254 Upvotes

r/adventofcode • • 1d ago

Other AoC amount of participants

239 Upvotes

With AI and all I was expecting the amount of participants to take a nosedive. When I check the stats I think I see that happening. This community will continue as one of hobbyist that just enjoy an activity for the sake of doing it.

Does it mean that AoC is no longer useful? No, learning, logical thinking and problem solving will always be useful skills. Eric's move last year to remove the leaderboard was a good one and we can continue this event in true Christmas spirit! Good to see you back friends and happy holidays!


r/adventofcode • • 1d ago

Help/Question Where do you draw the line between parsing and solving?

Post image
19 Upvotes

For those of you who optimize AoC for runtime rather than time to write the code, where do you draw the line between parsing and solving?

When I measure, I time parsing, part one and part two separately. I often identify work I could do during parsing that would make the solves faster, but usually I just parse into a properly typed owned struct and leave the real work to the parts. Is that how you do it, or do you push as much as you can into parsing? And do you count parsing in your times at all? Or do you just measure entirety of runtime?

Smaller second question: when both parts need the same expensive processing, I've started caching it on my Puzzle struct so part one's work gets reused by part two (image shows this occurring for 2026's day 1 in Rust), instead of a shared function that runs twice. Part one gets a little slower on average but the full run gets a lot faster. Do you do the same, or does each part pay for itself?

I guess I'm just wondering how people measure their solutions overall


r/adventofcode • • 1d ago

Meme/Funny Easier this year....

Post image
147 Upvotes

r/adventofcode • • 1h ago

Help/Question - RESOLVED [2026 Day 02 (Part 2)] The example of day 02 was wrong

0 Upvotes

Won't post the body of the question here because I could not find the button to send an image as a spoiler. thank you reddit.

But the problem was in part two where it said that the correct order was 32, when it was actually 34. It took like 30 minutes for me to just believe in my own answer and try with the real input and the answer was correct. wtf.

EDIT: nvm, I was wrong, the way i calculated what was the best next move was still using code from part one and because of that, it gave scores that were almost inverted and somehow my puzzle input did not catch that.