Source: Day 16: Reindeer Maze
Full solution for today (spoilers!).
Part 1
Given a maze, what is the shortest path between
S
andE
where walking straight costs one and turning costs 1000.
Full solution for today (spoilers!).
Given a maze, what is the shortest path between
S
andE
where walking straight costs one and turning costs 1000.
Full solution for today (spoilers!).
Given a warehouse containing floors (
.
), walls (#
), boxes (O
), and the player (@
) plus a series of instructions^V<>
, move the player according to the instructions, pushing boxes (which in turn can push more boxes).Calculate the sum of
y * 100 + x
for each box’s final position.
Full solution for today (spoilers!).
Given a series of robots defined with initial
position
andvelocity
on a 101x103 toroidal grid, calculate where the robots will be after 100 iterations. Return the product of the number of robots in each quadrant of the final grid, ignoring the middle lines (since they’re odd).
Full solution for today (spoilers!).
Given Button A
(ax, ay)
, Button B(bx, by)
, and Prize(px, py)
; how many times must you press Button A (a
) and Button B (b
) to reach the Prize? Sum3a + b
for each machine that has a solution.
Full solution for today (spoilers!).
Given a
Grid
of regions, calculate the sum of the productperimeter * area
for each region.
Full solution for today (spoilers!).
Given a sequence of values
v_n
, replace each value with the first matching rule:
if v = 0 -> 1
- If
v
has an even number of digits, split it (sov = 8675
becomes[86, 75]
)- Otherwise,
v -> v * 2024
Calculate how many elements are in the sequence after 25 iterations.
Full solution for today (spoilers!).
Given a heightmap (
0
to9
), for each0
count how many9
you can reach on paths that only ever increase height by exactly 1 at a time. Sum these values.
Full solution for today (spoilers!).
Given a disk layout alternating between files and empty spaces, move all files as early on the disk is possible, splitting into multiple blocks. Return a checksum on the disk.
Alternating means:
23331
would mean a 2 block file, 3 empty, a 3 block file, 3 empty, and a 1 block file.The checksum is the sum of
file_id * block_index
for all occupied blocks. File IDs are assigned sequentially on initial generation.
Full solution for today (spoilers!).
Given a grid with either open tiles (
.
) or towers (anything else), for each pair of towers, there is an antinode at each of the points that is 2x as far from one tower as the other. How many antinodes are there still within the bounds of the map?
Full solution for today (spoilers!).
Given a result and a list of numbers, determine if any combination of addition (
+
) and/or multiplication (*
) using all the given numbers in order can return the result. Ignore order of operations.