Improve your programming skills with Advent of Code
Next Monday we turn our calendars to December and for us software developers it means Advent of Code starts again, for the 11th year. This year, there are some new changes though that will hopefully make it more approachable to many people.
What is Advent of Code?
Advent of Code is an annual Christmas calendar of programming puzzles that you can solve anyway you wish, created by Eric Wastl. You can choose your tools, programming languages and approaches: some people try to solve them as quickly or as efficiently as possible; others use the time to learn a new programming language or challenge them to solve them in ways that restrict what is available to them. One of the best parts of Advent of Code is that you get to choose how to do it.
Each day, you’ll receive a puzzle and an input. For example, let’s take a look at the first day of last year’s calendar, day 1 of 2024.
There’s a bit of lore to get you into the right Christmas mood — usually Santa has disappeared or something important has gone missing or broken and it is our job to help the elves through solving puzzles to save Christmas.
For that puzzle, you receive an input that looks like this:
3 4
4 3
2 5
1 3
3 9
3 3
and a task:
Pair up the smallest number in the left list with the smallest number in the right list, then the second-smallest left number with the second-smallest right number, and so on. Within each pair, figure out how far apart the two numbers are; you'll need to add up all of those distances.
You then write code that takes the provided input, solves it and outputs a single number. Everyone gets their own custom generated input so you can’t just copy an answer from a friend but need to generate it by yourself using your input.
Once you solve a puzzle successfully, a second part is revealed. It usually introduces a twist — maybe you need to calculate something more complex or some parameters of the puzzle change, challenging you to solve a similar but slightly different puzzle.
For the first decade, we got 50 of these puzzles: 2 for every day from December 1st to December 25th, often increasing in complexity or difficulty. This year, Eric decided to only have 12 days of puzzles, making the entire ordeal a bit easier to chew:
Why did the number of days per event change? It takes a ton of my free time every year to run Advent of Code, and building the puzzles accounts for the majority of that time. After keeping a consistent schedule for ten years(!), I needed a change. The puzzles still start on December 1st so that the day numbers make sense (Day 1 = Dec 1), and puzzles come out every day (ending mid-December).
I welcome this change with open arms. Quite often, around 18th or 19th, real life Christmas preparations start to take up the time from the calendar and as the complexity of the puzzles grow, I’ve found it has become more and more challenging to find time to solve the last problems.
You can solve them as you wish
You don’t have to solve the days in order: the next day will be available even if you haven’t solved the previous ones. You also don’t have to solve all of them or do one each day. I often see people drop out because they missed a day and feel like the backlog starts to grow unmanageable.
I understand where that sentiment comes from but I want to encourage everyone to participate, skip the days that are too hard or too busy and continue from the next day. There are rarely part 1 puzzles that have any connection to previous ones and never any that cannot be solved if you haven’t solved the previous.
Best part is the community
Solving puzzles is fun and all but the real treat is the friends we make along the way. Every year, I come back to Advent of Code because it’s so nice to do together. In pretty much every developer community I’m part of, we have a forum/Slack/Discord threads for each day, asking for help, sharing our solutions and generally getting excited about the puzzles.
We also organise in person gatherings where we solve puzzles and have a good time.
The flexibility of Advent of Code fits this kind of community approach so well. One person can solve puzzles in Java, another in Rust and third in Python and they can share ideas and solutions and learn together even when they don’t share a single programming language.
It’s also fun to see how different programming languages fit different types of puzzles.
I use Advent of Code to teach programming
My approach for the past few years has been to solve the puzzles using Python and then write about my solutions and tools I use with the intention of teaching programming and Python to new audiences and to inspire new people to participate.
I think Advent of Code can be a brilliant way for new developers to get a lot of practice. The puzzles are well written and don’t require any specific tools or libraries. Basic programming language constructs can get you there. And since all previous years’ puzzles are always open, there’s a decade’s worth of puzzles to practice on if you get excited about AoC this year.
You can find my previous solutions from /adventofcode, categorised by year.
You can also read more blog posts about Advent of Code if you want to pick up my general tips and tricks for making Advent of Code a great experience.
If something above resonated with you, let's start a discussion about it! Email me at juhamattisantala at gmail dot com and share your thoughts. In 2025, I want to have more deeper discussions with people from around the world and I'd love if you'd be part of that.