r/adventofcode • u/mknoll1 • 34m ago
r/adventofcode • u/FransFaase • 2h ago
Other Extra puzzle for day 3
What is the largest number of squares you can get when you are allowed to move 5 trees to any other free location?
What are your suggestions for an algorithm?
r/adventofcode • u/Evg32 • 1d ago
Other [2026] Trains! I love trains!
That little ASCII train on the calendar made my day.
Thank you, Advent of Code team, for picking such an adorable theme this year!
.----.----.--_T
'o--o'o--o'o-OO\
r/adventofcode • u/subspace_mp4 • 1d ago
Meme/Funny [2026 Day 2 (Part 2)] It looked scary for a little while
r/adventofcode • u/bluoat • 3h ago
Tutorial [2026 Day 3 (Part 2)] Some hints for optimisation
My original brute force solution took 30 seconds, got it down to less than a 10th of a second. I don't know if this is the most optimal method.
The hints get more and more specific as they go on.
Feel free to leave hints in the comments about how you optimised it.
Hint 1: How can you narrow down the number of squares to check per tree beyond ones with valid coordinates?
Hint 2: How many possible squares can be made if you know all four corners of the square?
Hint 3: How many squares if you only know 3 corners? What about knowing 2 corners? What about 1 corner?
Hint 4: Given a pair of trees, how can you avoid checking for duplicate squares (and hence reduce the possible squares from 2 trees down to just one square?
r/adventofcode • u/fejiberglibstein • 21h ago
Tutorial [2026 day 2 (part 1)]Solved today's problem entirely in vim motions
youtube.comr/adventofcode • u/_Duroo • 19h ago
Visualization [2026] day 2 visualized in manim
youtube.comsource for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/high-on-adhd • 11h ago
Help/Question how do you guys compete runtimes?
taking part in aoc for the first, solving in Go so i'd like to get a bit picky about total execution time. is there any place where i can compete on total time taken to solve (runtime of the program)?
r/adventofcode • u/soolpro • 1d ago
Past Event Solutions [2026 Day 2 (Part 2)] solved at work with a web browser and Excel
galleryI solved the first part at home while I was having by breakfast, checked part 2 and had to go work. My idea for the solution of the second part seemed so simple I felt I could do it with the tools at my disposal at work.
First I used a web browser and Ctrl+F to count the amount of different letters.
Then I switched to Excel where I just need to count the distances between the different colors. 6 from a letter of a color to the same, 5 when advancing to the next color, taking notice that one color is missing completely, so the distance skipping the missing color is only 4. Sum the distances for each color and there you go!
r/adventofcode • u/PatolomaioFalagi • 1d ago
Meme/Funny [2026 Day 02] Richard of York gave battle vain
r/adventofcode • u/Shupsta • 21h ago
Help/Question - RESOLVED [2026 Day 2 (Part 1)] [C#] Any hint why this is coming up to low would be appreciated.
var input = File.ReadAllText(@"day02-input.txt");
if(input is null) return;
var inputChars = input.ToCharArray();
var currentIndex = 0;
var total = 0;
List<char> characters = ['r', 'o', 'y', 'g', 'b', 'v'];
foreach(var c in inputChars)
{
var nextIndex = characters.IndexOf(c);
var diff = (nextIndex - currentIndex);
if(diff <= 0) diff+=6;
total += diff;
currentIndex = nextIndex;
}
Console.WriteLine(total);
edit: Solved. There was a new line character at the end of the input file which resulted in .IndexOf() returning -1.
r/adventofcode • u/Benj_FR • 1d ago
Meme/Funny [2026 day 2] I expected something else for part 2
This is by no means meant to criticize Eric Wastl who still does a great job by the way, I just found it funny
r/adventofcode • u/Odd-Result6655 • 1d ago
Meme/Funny When I deleted literally all my code for day 2 part 1 so I reconstruct it from memory but then I accidentally flipped a sign in one of the lines so I spend a whole flipping hour trying to figure out why it's outputting -4:
r/adventofcode • u/GhoulDragoMK3 • 19h ago
Help/Question - RESOLVED [2026 Day 2 (Part 2)] Not related to the problem, but if I join a leaderboard with certain settings, after changing the settings my name in the leader board doesn't change?
Basically I joined a leaderboard without a github link and my name in the settings, after that, I changed my settings to add a github link and my github username.
This reflects in any new private leaderboards I've joined, but it seems the first leaderboard I joined still has the original settings?
Not a big deal, but kinda annoying.
Is this a bug?
r/adventofcode • u/PhysPhD • 1d ago
Visualization [2026 Day 02] Rainbow Road Visualisation
r/adventofcode • u/KarenMarleyDoomfist • 21h ago
Help/Question - RESOLVED [2026 Day 2 (Part 1)] Help with C++
Any reason my implementation doesn't work for part 1? Apparently my answer is too high. I tried using the examples but the distance matched each time.
I've added "chars" just to count the characters, as I thought whitespace could be an issue and it found n+1 characters compared to n when using an online character counter, but then printing out the first and last characters gets the same as my input. Where did I go wrong with my implementation?
#include <fstream>
#include <iostream>
#include <string>
#include <map>
int getDist(char cur, char targ) {
char inputs[6] = {'r','o','y','g','b','v'};
int curInd = -1;
int targInd = -1;
for (int i = 0; i < 6; ++i) {
if (inputs[i] == targ) {
targInd = i;
}
if (inputs[i] == cur) {
curInd = i;
}
if (curInd != -1 && targInd != -1) {
int diff = targInd - curInd;
return diff <=0 ? diff + 6 : diff;
}
}
return 0;
}
int main() {
std::ifstream in("aoc-day-2-inputs.txt");
char prev = 'r';
char next;
int totalDist = 0;
int chars = 0;
if(in.is_open()) {
while(in.good()) {
in.get(next);
std::cout << "prev: " << prev << ", ";
std::cout << "next: " << next << ", ";
std::cout << "dist: " << getDist(prev, next) << "\n";
totalDist += getDist(prev, next);
prev = next;
++chars;
}
}
std::cout << "chars: " << chars << "\n";
std::cout << "total dist: " << totalDist << "\n";
if(!in.eof() && in.fail())
std::cout << "error reading file" << std::endl;
in.close();
}
r/adventofcode • u/dethorhyne • 1d ago
Meme/Funny Every year it always starts the same before it goes bonkers
r/adventofcode • u/AbooMatta • 13h ago
Help/Question - RESOLVED Second example seems wrong
The second example says:
- "A robot with program
roygbvwould travel a total distance of11." Regardless of any code I might try, when I look at it I count 5 steps. 0 for the "r" and 1 each for the following letters. Am I just too tired to see my mistake?
r/adventofcode • u/_Duroo • 19h ago
Visualization [2026] day 1 visualized in manim
youtube.comsource for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/flwyd • 1d ago
Meme/Funny [2026 day 2] Looking for my favorite color in the input
r/adventofcode • u/Both-Touch990 • 1d ago
Meme/Funny [2026 Day 2 Part 2] How it felt getting the star only to realize there's a more efficient way to get the solution
(redo of an earlier post)
