Skip to content

Advent of Code 2024 solutions using a different language for each day

License

Notifications You must be signed in to change notification settings

fwcd/advent-of-code-2024

Repository files navigation

Advent of Code 2024

Run

My solutions to the Advent of Code 2024, written in 25 different programming languages.

Development

The programs are packaged with Nix, a functional package manager for Linux and macOS that focuses on reproducible builds. This makes it easy to build the programs, both locally and CI, without relying on system packages.

To build one of the days, cd into the corresponding directory and build and/or run the Nix flake. For example, to run day 1, use the following commands:

cd day01
nix run . resources/input.txt

Every day is packaged up to take exactly one command-line argument, the input file, and usually includes the demo input from the exercise too.

Tip

The build environment can be added to the current PATH using nix develop. This is useful to manually run the compiler.

Lessons Learned

  • Dijkstra, Dijkstra, Dijkstra (day 16, 18, 20)
  • The Lanternfish-style counting trick seems to be useful (day 11, 21)
  • Plot graph-like inputs with GraphViz (day 23, 24)
    • In some cases, the solution is visually apparent in the plot (23.2)
  • Use bigger ints, ideally at least 64-bits (day 17, 21, 24)

Previous Years

My solutions to the previous challenges can be found here:

About

Advent of Code 2024 solutions using a different language for each day

Topics

Resources

License

Stars

Watchers

Forks