Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/cj81499/advent-of-code/llms.txt

Use this file to discover all available pages before exploring further.

Advent of Code 2022 was a productive year for cj81499, with 24 days having at least Part 1 solved and the majority of those earning both stars. Notable gaps are Day 19 (Not Enough Minerals — unsolved) and the Part 2s of Days 16, 17, 22, and 25. Every solved day includes a corresponding test suite. The puzzles range from classic graph-search and simulation problems to number-theory tricks, expression trees, and blizzard-dodging pathfinding.
Puzzle inputs are personal and are not included in the repository. To run these solutions you will need to supply your own input, for example via aocd. See Solution Structure for how the project is organised.

Progress

DayTitlePart 1Part 2Tests
01Calorie Counting
02Rock Paper Scissors
03Rucksack Reorganization
04Camp Cleanup
05Supply Stacks
06Tuning Trouble
07No Space Left On Device
08Treetop Tree House
09Rope Bridge
10Cathode-Ray Tube
11Monkey in the Middle
12Hill Climbing Algorithm
13Distress Signal
14Regolith Reservoir
15Beacon Exclusion Zone
16Proboscidea Volcanium
17Pyroclastic Flow
18Boiling Boulders
19Not Enough Minerals
20Grove Positioning System
21Monkey Math
22Monkey Map
23Unstable Diffusion
24Blizzard Basin
25Full of Hot Air

Notable Solutions

Day 12 — Hill Climbing Algorithm

Part 1 finds the shortest path from the marked start S to the end E across a height-map grid where each step may only climb at most one elevation unit. A BFS from S records the cost to reach every cell; the answer is the BFS distance recorded for E. Part 2 asks for the shortest path from any ground-level cell (a or S) to E. Rather than running a separate BFS from every possible starting point, the solution simply reverses the search direction: it starts the BFS at E and relaxes the movement constraint accordingly (now a step can only descend at most one unit). The first ground-level cell reached by this reverse BFS gives the global optimum in a single pass.

Day 21 — Monkey Math

Part 1 evaluates a tree of monkey expressions where each monkey either holds a literal integer or applies an arithmetic operator to the values of two other monkeys. Lazy resolution (each UnresolvedMonkey caches its resolved form on first access) means the full expression tree is evaluated in one recursive pass. Part 2 changes the root monkey’s job to an equality check and asks what value the humn monkey must have to satisfy it. The solution avoids symbolic algebra by walking the expression tree twice: first it determines which subtree contains the humn node, then it propagates a target value back down that subtree, inverting each arithmetic operation along the way (add ↔ subtract, multiply ↔ divide, with correct handling of non-commutative subtraction). No external solver is needed — the tree structure guarantees a unique path from root to humn.

Day 24 — Blizzard Basin

The valley is filled with blizzards that move and wrap around each minute, making the navigable cells time-dependent. The solution simulates the blizzard grid incrementally using functools.cache: grid_after(t) is computed from grid_after(t-1), so each unique minute is only simulated once even across multiple traversals. Pathfinding uses a min-heap (Dijkstra-style) where each state is (time, pos). At each step the candidate can wait in place or move in any of the four cardinal directions, provided the destination cell is empty at the next time step. Part 2 requires three legs — start → goal, goal → start (the elf forgot their snacks), then start → goal again — by re-running the same explore function with the arrival time of one leg as the departure time of the next. The cached blizzard simulation is shared across all three legs, so previously computed grid states are reused for free.

Build docs developers (and LLMs) love