Sean McLemon | Advent of Code

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

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


2015-12-19 - Medicine for Rudolph

(First cell of article is code)

2015-12-18 = Like a GIF For Your Yard

Puzzle input is a grid of lights, composed of '#' (meaning "on") and '.' (meaning "off"). Part one involves applying a set of Game Of life type instructions and counting how many lights are "on" after 100 time steps. Part two involves doing the same but forcing the corner lights to always be on.


2015-12-17 - No Such Thing as Too Much

Puzzle input is a set of integers that describe volumes of containers in litres. Part one involves finding how many combinations of these containers can be used to hold 150 litres of "eggnog". Part two involved finding what combination of these involves the minimum number of containers, and finding how many have that number of containers.


2015-12-16 - Aunt Sue

Puzzle input is a set of properties that we know about ~500 aunties called Sue. Part one involves taking a set of readings and matching them against a given sue. Part two involves taking these readings and matching them in a slightly different way to find the correct Sue.


2015-12-15 - Science for Hungry People

Puzzle input is a list of ingredients and some properties about those. Part one involves finding the combination of these ingredients that maximises the product of all their properties (except calories). Part two involves finding the maximum scoring cookie that has exactly 500 calories.


2015-12-14 - Reindeer Olympics

Puzzle input is a description of speed, flight + rest cycles of various reindeer. In part one we find out which reindeer travelled the furthest after 2503 time steps. In part two we find which has the greatest "score" (i.e. was in the lead for the most number of time steps) after the same length of time.


2015-12-13 - Knights of the Dinner Table

Puzzle input is a set of instructions describing how happy some people would be to sit next to someone else at a dinner table. Part one involves finding the arrangement with the maximum happiness-level. Part two involves adding "me" into the mix, where I'm ambivalent about everyone (happiness change of 0) and they're ambivalent about me.


2015-12-12 - JSAbacusFramework.io

Problem input is a json file. Part one involves finding the sum of the numbers in the structure. Part two involves the same sort of thing, but evaluating dictionary-type structures as zero if any node has a value "red".


2015-12-11 - Corporate Policy

Puzzle input is a password. Part one involves finding the next password (i.e. "increment" the letter from the right col) until you get a "valid" password according to the three rules defined in the comments. Part two involves finding the next one after that.


2015-12-10 - Elves Look, Elves Say

Puzzle input is a string of integer digits. Part one involves applying some rules of a game to expand the string of digits 40 times. Part two is the same but for 50 times.


2015-12-09 - All in a Single Night

Puzzle input is a description of routes between destinations and their costs. Part one requires you to find the shortest path that touches every destination exactly once. Part two requires you to find the longest path that touches every destination exactly once.


2015-12-08 - Matchsticks

Puzzle input is a sequence of escaped strings, surrounded by quotation marks. Part one involved unescaping the strings and finding out how many chars fewer there are when you do. Part two involves adding an extra layer of escaping on top of the input strings, and counting how many chars more there are now.


2015-12-07 - Some Assembly Required

Puzzle input is a series of instructions (see test_input_str) that set some "wires" (named values, like registers) according to some very simple bitwise operations - and, or, left-shift, right-shift and not. In part one we try evaluate the instructions to find the final value written to wire "a". In part two we have to override the value written to the wire "b" to the value written to part "a" in the first part, and then re-run and find what's written to "a".

This implementation is kinda nasty - I just repeatedly loop through the instructions to see if we can evaluate anything, and if we changed anything we go through the remaining instructions. There's clearly a nicer way to do this :)


2015-12-06 - Probably a Fire Hazard

Puzzle input is a sequence of instructions which control sections of a grid of light. In part one we interpret the instructions as simply switching the lights between on or off states, and finding how many are still on after all the instructions are applied. In part two we interpret them as controlling brightness levels of individual lights, and finding the sum of each light's brightness levels.


2015-12-05 - Doesn't He Have Intern-Elves For This?

Puzzle input is a bunch of newline separated strings. Part one involves finding how many of these fit three rules:

1) It contains at least three vowels (aeiou only), like aei, xazegov, or aeiouaeiouaeiou.

2) It contains at least one letter that appears twice in a row, like xx, abcdde (dd), or aabbccdd (aa, bb, cc, or dd).

3) It does not contain the strings ab, cd, pq, or xy, even if they are part of one of the other requirements.

Part two involves finding how many fit two different rules:

1) It contains a pair of any two letters that appears at least twice in the string without overlapping, like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps).

2) It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa.

My solution is ugly and inefficient :)


2015-12-04 - The Ideal Stocking Stuffer

Puzzle input is a seven-character string. Part one requires us to find the lowest number n where the md5 hash of the input concatenated with n starts with five "0"s. Part two is the same but for six "0"s.


2015-12-03 - Perfectly Spherical Houses in a Vacuum

(First cell of article is code)

2015-12-02 - I Was Told There Would Be No Math

Puzzle input is a sequence of (length,width,height) dimensions of presents. For part one we have to find the area of wrapping paper required (surface area of present + slack, where the slack is one unit of the smallest side). Part two involves finding the length of ribbon required (smallest distance around the present + some length for the bow, where the bow length is same magnitude as volume but in feet)


2015-12-01 - Not Quite Lisp

Puzzle input is a sequence of '(' and ')' characters. Part one involves interpreting them as instructions to move up - '(' - or down - ')' floors in a building and seeing where you end up if you follow these instructions. Part two involves following the instructions but finding out the first step that causes you to enter the basement (floor -1)