Sean McLemon | Advent of Code

Home | Czech | Blog | GitHub | Advent Of Code | Notes

My Advent Of Code 2021 solutions. See also 2021, 2020, 2019, 2018, 2017, 2016 and 2015.


2022-12-19 - Not Enough Minerals

(First cell of article is code)

2022-12-18 - Boiling Boulders

(First cell of article is code)

2022-12-17 - Pyroclastic Flow

(First cell of article is code)

2022-12-16 - Proboscidea Volcanium

(First cell of article is code)

2022-12-15 - Beacon Exclusion Zone

Day 15 puzzle input is a sequence of sensors, their x/y positions and the x/y position of the closest "beacon" (by manhattan distance) to each sensor (mine is here). Part 1 involves using this information do determine how many positions on one line (on the grid where y=2_000_000) cannot contain a breacon. Part 2 involves assuming the beacon is somewhere between the x/y positions 0->4,000,000, and searching for the one position that isn't covered by a sensor.


2022-12-14 - Regolith Reservoir

Day 14 puzzle input is a sequence of "->"-separated point pairs which describe rock formations (mine is here). Part 1 dropping grains of sand from a given point, until the sand overflows and drops off to "the abyss". Part two involves assuming there is no abyss, but an infinitely wide floor 2 rows below the lowest rock and pouring sand in until it builds up to the top and finding how many grains this takes.


2022-12-13 - Distress Signal

Day 13 puzzle input is a set of pairs os nested lists of numbers, sometimes empty (mine is here). Part 1 involves performing a weird calculation to determine how many of each pair is in the "right order". Part 2 involves ignoring the idea that they're "pairs", including a couple of additional sets, sorting them and multiplying the position where these marker sets end up.


2022-12-12 - Hill Climbing Algorithm

Day 12 puzzle input is a grid of letters with the lower-case letters representing heights (a being the lowers, z being the highest) as well as the start point S and the destination E which have heights "a" and "z" respectively (mine is here). Part 1 involves finding the shortest path from S to Z (where you can only travel "up" one height unit). Part 2 involves finding the shortest path from any a-height point to E.


2022-12-11 - Monkey in the Middle

Day 11 puzzle input is a description of how some monkeys will throw some items around between them depending on some properties I'm not even going to begin to summarise (mine is here). Part 1 involves simulating how the monkeys will behave for 20 "rounds" of this throwing, then finding the two monkeys which handled/"inspected" each item and multiplying these numbers. Part 2 involves doing adjusting part of the calc (there's a point where we divide a "worriedness" number previously, that we now no longer do) and running for 10,000 rounds.


2022-12-10 - Cathode-Ray Tube

Day 10 puzzle input is a sequence of assembly-like instructions - addx {arg} which takes 2 cycles and noop which takes a single cycle - which operate on a single register x (mine is here). Part 1 involves making a cycle-accurate simulator that executes thsi code, and sampling the x register at given points in time (cycles 20, 60, 100, 140, 180 and 220) and calculating the sum of the x * elapsed_cycles at that point. Part 2 involves interpreting this in a fun and weird way such that it draws pixels on a simple 40x6 pixel display.


2022-12-09 - Rope Bridge

Day 9 puzzle input is a sequence of move instructions - up/down/left/right + a distance - (mine is here). Part 1 involves taking a rope of length two units (well "knots" but w/e) and moving it around, noting how many unique positions the tail sits in. Part 2 is the same, but for a rope of length ten units/knots.


2022-12-08 - Treetop Tree House

Day 8 puzzle input is a grid of numbers representing tree heights (mine is here). Part 1 involves finding whether any tree is "visible" (taller than all trees either above, below, left or right of it). Part 2 involves calculating a "scenic score" based on the product of the number of trees smaller than it in all directions.


2022-12-07 - No Space Left On Device

Day 7 puzzle input is a sequence of characters (mine is here). Part 1 involves reconstructing a file system hierarchy from the output of cd and ls commands, and finding the sum of all folder sizes under 100_000. Part 2 involves using this reconstructed file-system hierarchy to find which is the smallest folder to delete that allows our 70_000_000 (byte? megabyte?) filesystem to have at least 30_000_000 bytes/megabytes/units/sectors/whatever free.


2022-12-06 - Tuning Trouble

Day 6 puzzle input is a sequence of characters (mine is here). Part 1 involves finding the location in the stream after the first sequence of four characters that where none repeat. Part 2 is the same but for fourteen characters.


2022-12-05 - Supply Stacks

Day 5 puzzle input is description a description of some crates, followed by some instructions that describe movements of items between them clean (mine is here). Part 1 involves following the movement instructions as if you're individually popping items the top of one and finding the top element of each. Part 2 involves the same but popping entire blocks in-place from one to another.


2022-12-04 - Camp Cleanup

Day 4 puzzle input is a list of pairs of ranges which represent which sections a given elf is assigned to clean (mine is here). Part 1 involves finding how many elves were given a pair of section assignments where one assignment completely contains the other. Part 2 involves finding how many elves simply have overlapping assignments.


2022-12-03 - Rucksack Reorganization

Day 3 puzzle input is a list of ascii strings which represent a rucksacks with two compartments that contains some items (mine is here). Part 1 involves looking at each rucksack's contents, finding how many items occur in both compartments and summing the results for all rucksacks. Part 2 is taking groups of three rucksacks, finding how many items occur in any compartment in all three - then calculating the sum of these for all groups.


2022-12-02 - Rock Paper Scissors

Day 2 puzzle input is a sequence of either A, B or C followed by either X, Y or Z (mine is here). Part 1 involves interpreting these as a set of instructions as to what you and an opponent will play in rock, paper scissors and calculating a score. Part 2 involves interpreting these slightly differently (what your opponent will play, and whether you should win, lose or draw) then calculating the score as before.


2022-12-01 - Calorie Counting

Day 1 puzzle input is groups of integers which represent "calories" of food some elves can carry (mine is here). Part 1 involves finding the elf who can carry the most. Part two is finding the sum of how much the top-three elves can carry.