Advent of Code: Day 23

Source

Part 1: Create a simple virtual machine with two registers (a and b, non-negative integers) and six instructions:

  • hlf (a|b) - divide the given register by half, round down
  • tpl (a|b) - triple the given register
  • inc (a|b) - add 1 to the given register
  • jmp [+-]\d+ - jump forward/backwards by the given number of instructions
  • jie (a|b), [+-]\d+ - if the given register is even, jump
  • jio (a|b), [+-]\d+ - if the given register equals one, jump

read more...


Advent of Code: Day 21

Source

Part 1: Given a shop full of weapons (buy exactly one), armor (buy zero or one), and rings (buy 0, 1, or 2), determine the set of items that will defeat a given enemy for the minimum cost (see the original writeup for more details).

read more...


Advent of Code: Day 20

Source

Part 1: P(n) is defined such that for each number i, add 10i to any number divisible by i. Find the first value n such that P(n) is at least a given target number.

read more...


Advent of Code: Day 17

Source

Part 1: Given a list of containers of varying sizes and a total volume to contain, determine how many different combinations of containers match exactly the given volume.

read more...


Advent of Code: Day 16

Source

Part 1: Given a list of target values of the form:

children: 3
cats: 7
samoyeds: 2

And a list of ‘Aunt Sues’, each with known values:

Sue 1: children: 1, cars: 8, vizslas: 7
Sue 2: akitas: 10, perfumes: 10, children: 5
Sue 3: cars: 5, pomeranians: 4, vizslas: 1

Determine which Sue has no unset but matching values.

For example, Sue 1 is invalid because children is 1 versus 3 and Sue 2 because children is 5 versus 3. Given only the values above, Sue 3 would be valid since there are no contradictions.

read more...


Advent of Code: Day 15

Source

Part 1: Input is a list of ingredients of the form:

Frosting: capacity 4, durability -2, flavor 0, texture 0, calories 5
Candy: capacity 0, durability 5, flavor -1, texture 0, calories 8

A recipe score is a product of the positive quantity scores (ignoring calories), where each quantity score is the product of the quantity and that product for each product.

For example, 4 Frosting and 2 Candy above, would have a score of of -2 * 4 + 5 * 2 = 2 for durability and 0 * 4 + -1 * 2 = -2 (and thus ignored as we only accept positive scores) for a total thus far of 2.

read more...


Advent of Code: Day 14

Source

Part 1: Given a list of running patterns of the form Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds., determine who will be in the lead after 2503 seconds.

read more...