New25 days of prep before 1 December

Get ready for
Advent of Code.

A 25-day course on the data structures and algorithms Advent of Code keeps asking for, from reading your input to breadth-first search, memoization and Dijkstra. Then a workspace for the real puzzles in December.

See the 25 days

Python, TypeScript, C#, Go and Rust · Day 0 and days 1 to 3 free

How a day works

See why a pattern matters before you learn how it works.

Each day is one classic technique, in two parts with a star each, like the event itself. You watch the obvious way and the better way race on the same input, write the pattern once in a warm-up, then solve a puzzle of your own.

Learn

Day 9, counting pieces of stained glass

Squares visited on a window the size of a real puzzle input, 140 × 140.

Fill from every square467,376Flood fill, each piece once19,600
Warm-up

Write the pattern once

A small version with a few lines left for you, so the shape of the code is yours before the puzzle.

Check

Hidden tests, two stars

Your answer runs against tests you can't see, the way December's real inputs work. Pass a part, earn its star.

Tutor and review

Hints, not answers

Stuck? The tutor asks the next good question. Done? Review your code at your level and compare it with the course's version.

The 25 days

What to study for Advent of Code, in order.

Classic computer science, ordered after every Advent of Code puzzle since 2015, so each pattern arrives a little before December usually needs it. Part 1 teaches the technique; part 2 is the next step up.

  1. 1
    Reading inputTotals by group
  2. 2
    Lists and sortingCounting with maps and sets
  3. 3
    Strings and regexRules for every line
  4. 4
    Grids: points, neighbors, edgesWalking with a direction
  5. 5
    Step-by-step simulationEverything changes at once (Game of Life)
  6. 6
    Grids with no edgesManhattan distance
  7. 7
    GraphsTopological sort
  8. 8
    Shortest path: breadth-first searchState in the queue
  9. 9
    Flood fillPerimeters and sides
  10. 10
    A tiny computerWhen the program loops
  11. 11
    BacktrackingMemoization
  12. 12
    Dynamic programmingCounting the ways
  13. 13
    Cycle detectionSkip ahead a billion steps
  14. 14
    Modular arithmeticLCM and the Chinese remainder theorem
  15. 15
    Ranges, not valuesSplitting ranges through rules
  16. 16
    Stacks and nestingOperator precedence
  17. 17
    Binary searchSearching for the answer itself
  18. 18
    Dijkstra's algorithmPaths with extra state, and A*
  19. 19
    BitmasksPruning
  20. 20
    3D and hex gridsBoxes that overlap
  21. 21
    Shoelace formula and Pick's theoremCoordinate compression
  22. 22
    Union-findCliques
  23. 23
    Systems of equationsGaussian elimination
  24. 24
    Reverse engineering a programSpot the pattern in the output
  25. 25
    Put it all togetherFinish the other 49 stars
Day 0

New to all this? Start at zero.

Six short chapters on the ideas the 25 days build on: how fast a computer really is, big O by counting, what each container costs, memory, big numbers, and recursion. Every chapter has something to play with and code that runs in place.

  • How fast is a computer?napkin math
  • Big O, by countingn, n log n, n²
  • What each container costslist, set, dict
  • Memorystore less
  • Big numbersoverflow
  • Recursion and the stackdepth
December

Then solve the real puzzles here.

From 1 December, a workspace made for the event: the puzzle beside your code, your input fetched for you, and any of 30 languages with nothing to install. The tutor still gives hints, not answers, because the best part is solving it yourself.

  • Python
  • TypeScript
  • C#
  • Go
  • Rust
  • Java
  • Kotlin
  • Haskell
  • Zig
  • Elixir
  • OCaml
  • Ruby
  • Swift
  • Julia
Questions

Before you start

What should I study to get good at Advent of Code?

Reading and parsing text input, 2D grids, breadth-first search and Dijkstra for shortest paths, memoization and dynamic programming for when part 2 gets huge, and knowing when to reach for a set, a dict or a priority queue. The 25 days cover all of it, in roughly the order the event needs it.

When does Advent of Code start?

On 1 December. The prep course is open now, so you can work through it in the weeks before.

Do I need to know a programming language already?

You need the basics: variables, loops and functions. Day 0 covers the computer science ideas the rest builds on. The course runs in Python, TypeScript, C#, Go and Rust.

Is it free?

Day 0 and days 1 to 3 are free. Days 4 to 25 are part of Pro. Until 30 November, Pro is 50% off for your first two months with the code BLACKMONTH.

Is this the official Advent of Code?

No. Advent of Code is made by Eric Wastl, at adventofcode.com. This is an independent course to get ready for it, with puzzles of our own.

Fifty stars.
Start with one.

Pro 50% off for 2 months BLACKMONTH until 30 Nov

Advent of Code is made by Eric Wastl. cdbx is not affiliated with it.