Source: Day 15: Lens Library
Full solution for today (spoilers!)
Part 1
Hash each input (comma separated) with
h(v, c) = (v + c) * 17
(modulo 256 / as a byte). Sum these values.
Full solution for today (spoilers!)
Hash each input (comma separated) with
h(v, c) = (v + c) * 17
(modulo 256 / as a byte). Sum these values.
Full solution for today (spoilers!)
Given a grid of
#
andO
(among empty.
points) whereO
can move, slide eachO
as far north as it can. Score each based on how far north it is.
Full solution for today (spoilers!)
You are given a grid of
.
and#
. Find the (single) axis of reflection (between two rows or columns).
Full solution for today (spoilers!)
Given a sequence of
#.?
as on, off, and unknown and a sequence of group sizes, determine how many possible arrangements there are that match the given groups.More specifically, if you have
???.## 1,2
you need a single#
and a set of two##
, there are three possibilities:#...###
,.#..###
, and..#.###
.
Full solution for today (spoilers!)
Read a grid of
#
(stars) and.
(empty space). For each completely empty line or row, add another. Calculate the sum of the Manhattan distances between all pairs of stars.
Full solution for today (spoilers!)
You are given as input an ASCII art pipe diagram with straight pipes
|-
, right angle turnsLJ7F
, ground.
, and a start tileS
.The start tile will be part of a loop of pipes.
Find the distance to the furthest connected pipe segment from
S
(or half the length of the loop).
Full solution for today (spoilers!)
Given a list of terms, repeatedly calculate the differences of terms until these differences are 0. So:
0 3 6 9 12 15 3 3 3 3 3 0 0 0 0
Calculate the sum of next terms for each sequence (18 for this one).
Full solution for today (spoilers!)
Given a (repeated) sequence of moves (
L
for left andR
for right) and a directed graph where each node has two neighbors (left and right), count how many total steps it takes to get from the nodeAAA
to the nodeZZZ
. The sequence of moves can (and will) need to repeat.
Full solution for today (spoilers!)
Simulate a limited poker game with no suits and break otherwise tied hands lexicographically (
AAAA2
beatsAKAAA
) because the the hands are both four of a kind, the first cards are bothA
, but the secondA
beats theK
. It doesn’t matter that the first hand’s off card was a2
Order all hands then calculate the sum of the ordering of hands (1 for best etc) times the bet for each.
Full solution for today (spoilers!)
Simulate charging up race boats with the behavior that waiting X seconds to start means you move at X units per second. Given time allowed and a target distance, determine how many (integer) numbers of seconds will beat the target distance.