🏠 back to Observable

Advent of Code 2021

Anyone doing this year’s Advent of Code?

For anyone who has not come across Advent of Code before, it is a series of 25 coding challenges released once a day in December each year. The questions are very elegantly constructed to be both entertaining and to allow a range of solutions of varying sophistication. They also have a rather elegant way of generating (quasi) unique question variations and answer validation. Generally questions start off easy and increase in difficulty through the month.

Each day’s questions have two parts where the second part is only revealed once you complete the first. The second part often requires you to generalise the solution to the first, or possibly optimise it so it can handle more complex cases.

I think they are a great way to learn and improve coding skills and are well suited the literate programming style encouraged by Observable.

For info — my solutions (just links to the collection so no spoilers unless you open each day’s entries).

Perhaps we could use this thread to discuss interesting approaches and challenges thrown up by the daily questions?


Well, the first one was pretty cute and quite easy. I wonder how hard these get, though? I envision my kids waking up on Christmas day with no presents wrapped as I’m frantically putting the finishing touches on the Project Euler-like final problem. :confused:

Thankfully the December 25th puzzles tend to be easier than the preceding week’s worth (and there’s only one part). Having said that, the weekend ones tend to be harder than the weekday ones, so perhaps they’ll just cancel out.

See the charts of completion times of the fastest 100.

Have just come across this nice collection of solutions to this year’s AoC from @visnup. Makes good use of Plot and generators to animate solutions.


A little late to the party but I can confirm that it was a lot of fun. Even if this meant a few late nights shouting at a laptop while debugging some messy code (or staring at a Rubik’s cube) because I didn’t want to miss one day. :grinning:

Sometimes hard to explain why you find a specific problem more difficult than the previous / next one, but from my point of view days 23, 22, 19 and 24 were the most difficult (descending order).