- Day 01 ⭐⭐ in Vim
- Day 02 ⭐⭐ in Vim
- Day 03 ⭐⭐ in Vim
- Day 04 ⭐⭐ in Vim
- Day 05 ⭐⭐ in
- Day 06 ⭐⭐ in Vim
- Day 07 ⭐⭐ in Haskell (Main.hs, Lib.hs, Spec.hs)
- Day 08 ⭐⭐ in Vim animated solution
- Day 09 ⭐⭐ in Elixir (aoc.ex, main.ex, aoc_test.exs)
- Day 10 ⭐⭐ in Kotlin (App.kt, AppTest.kt)
- Day 11 ⭐⭐ in TypeScript (Bun)
(aoc.ts,
aoc.test.ts)
- the first really challenging problem of 2016
- BFS approach with seen states skipping
- initially by serializing states and comparing them, which was fine for part 1, but way too slow for part 2
- optimization for part 2 was to treat states as structurally identical - swapping single items or pairs between the floors would not matter for the number of required steps
- Day 12 ⭐⭐ in Crystal
(aoc.cr,
aoc_spec.cr)
- straight-forward mini assembly interpreter
- a language with
eval
would have reduce the code a lot…
- Day 13 ⭐⭐ in C++
(aoc.cpp,
aoc_tests.cpp,
main.cpp)
- flood fill algorithm
- using
std::bitset
for visited positions
- Day 14 ⭐⭐ in Python
(aoc.py)
- using
@functools.lru_cache
- using
- Day 15 ⭐⭐ in
Vim
- the puzzle is pretty much exactly the Chinese Remainder Theorem
- initially solved by hand, see Day 15 README
- Day 16 ⭐⭐
- Clojure (core.clj, core_test.clj) – runtime ~ 1 minute
- Rust (main.rs) – runtime < 1 second
- both solutions use the same algorithm (basically doing exactly what the puzzle asks for: creating the whole data string and then calculating the checksum), but the whole list creation stuff seems to be very slow in Clojure (probably due to me limited knowledge of the language)
- Day 17 ⭐⭐ in C#
(AoC.cs,
AoCTests.cs,
Program.cs)
- BFS
- caching MD5 hashes does not improve performance, as the hashed strings include the path taken, which is different for each step of the BFS
- runtime is good enough anyway (< 2 sec)
- Day 18 ⭐⭐ in Nim
(lib.nim,
tests.nim,
main.nim)
- surprisingly easy puzzle for day 18
- very naïve solution, but part 2 runs in ~ 6 sec
- Day 19 ⭐⭐ in
Zig
- part 2 was a struggle, eventually built my own circular double-linked list
- the trick to get the runtime from hours to basically instant was to have a pointer to the opposite of the circle, and moving that forward either one or two places, depending on the oddness of the remaining elves
- Day 20 ⭐⭐ in Julia
(
AoC.jl
,main.jl
,runtests.jl
) - Day 21 ⭐⭐ in Perl
(
AoC.pm
,main.pl
,tests.t
) - Day 22 ⭐ in Lua
(
aoc.lua
,aoc_spec.lua
,main.lua
)