Advent of Code 2021 notes

TypeScript | Problem statements | Source code

2021 was my first year doing AoC. By the end of 2021, I was invited to the Docusaurus team and my TypeScript skills improved steadily since. It was virtually the only language I programmed in, becoming the natural choice for 2021. However, for fear that the typings would slow me down where I don't need it, I actually stuck to untyped JS. But I also was naïve and didn't preserve my solutions, so I redid all of 2021 in TypeScript in 2025.

Despite familiarity, TypeScript was actually a poor choice for AoC because of its lack of built-in data structures including queues and hash maps. In particular the hash map issue was painful because I had to serialize all my keys into strings. Thank you to datastructures-js for providing priority queues, at least! I also didn't get to use most of the language features, except I forced generators and classes into 21. Granted, I found its pointer chasing to be the most straightforward, without magical CoW behavior.

Difficulty-wise, the 2021 me got all the way to 19 before bailing, so I think it was a very accessible year. Remarkably, there are not one, not two, but three problems that are bin-counting style DP: 6, 14, and 21. I took some time thinking about 17 because I was wholly occupied with a mathematical solution and didn't want to run much unnecessary code. 19 is challenging and tedious; 22's algorithm is perhaps unfamiliar to some; 24 is a very fun but also challenging in a non-coding way. 23 is standard DP, which was out of my league in 2021 but very natural in 2025.

landing page