DEV Community

Matt Ellen
Matt Ellen

Posted on

How do people solve Advent of Code puzzles so quickly?

I occasionally look at the leaderboard for the day, to see how long people are taking to solve the puzzles.

Top 9 of the AoC 2020 leaderboard for day 9

Some people seem to be getting through the puzzles in under 5 minutes after they go live. I can't even comprehend the puzzles in that amount of time, let alone write a solution.

What techniques do people use to get through the puzzles so quickly?

Is it possible they are cheating? I don't really think people are cheating, but their achievements are so extraordinary.

Top comments (9)

Collapse
 
tomhuntington profile image
tom-huntington • Edited

nthistle and johnathonpaulson, both who regularly finished top 10 in 2022, recorded all their solutions live and uploaded to youtube:

If you do the problems, then compare your solution to the most ergonomic ones from reddit.com/r/adventofcode/?f=flair... you quickly become much better.

Collapse
 
pavelloz profile image
Paweł Kowalski

Lets be honest, when there is a leaderboard of anything, people will go to extreme lengths to be on top for ego boost. Including cheating and spending every wake hour doing those kinds of things. Imagine your hobby was leetcoding... you would probably write answers with your eyes closed at some point. Just like chess players can play with each other with their eyes closed. At some point it just repetetive keysmashing, and keysmashing can be very fast ;)

Collapse
 
mellen profile image
Matt Ellen • Edited

I certainly expect there to be highly competitive people. I just didn't realise how good they could be!

Do you think they have some kind of automated processes for parsing the example input and answer and finding a solution for it?

I don't think they can be spamming the submit with random values until they get a hit, because the throttling seems quite robust.

Collapse
 
hierror profile image
Hierro Duarte

Although some people appear a few times at the top 10 positions, I think the majority of the best solutions for each puzzle aren't done using any automated process.

Some people are probably that good at solving these kinds of problems.

Collapse
 
pavelloz profile image
Paweł Kowalski • Edited

I think its just training. Fast reading (or should i say scanning for input/output data) and having code snippets ready for most popular cases/algo. ;)

Thread Thread
 
mellen profile image
Matt Ellen • Edited

Ah! I hadn't considered about having snippets ready to go. I bet that would help a lot.

Collapse
 
kais_blog profile image
Kai • Edited

Not sure if people are cheating. However, many puzzles can be solved in a very short time. If you want, just take a look at my step-by-step tutorial series for Advent of Code. In the end, you'll always find the full solution. Most of those have very few lines and they could be even shorter. Often, I'll write a bit more so that it's easier to explain :)

Something I'd like to add: It also comes down to experience. I often notice certain patterns and know exactly what I'll code to solve this puzzle in a very short time. I assume that highly competitive developers are even more "trained" in spotting patterns or at least finding a way to be fast.

Collapse
 
sjarva profile image
Senja Jarva • Edited

There are people who do this type of fast programming as somewhat serious hobby (I think it's called competitive programming), where they practice a) understanding the puzzle, b) remembering the most efficient data types and algorithms to solve it and then finally c) to actually produce the code in a language, that they know really well. I went to a high school that encouraged the most talented programmers to start doing this, first on a national level and then on an international level. So yeah, I'm guessing that many people on top of the list have done competitive programming at some part of their life :)

Collapse
 
mellen profile image
Matt Ellen

If I had the energy left at the end of work, I'd probably get into that. It makes a lot more sense that they'd be this fast if they're so practised at it.