Source: Day 20: Race Condition
Full solution for today (spoilers!).
Part 1
Given a maze with exactly one path, find how many single walls you can walk through (remove) that shorten the best path by at least 100 units.
Full solution for today (spoilers!).
Given a maze with exactly one path, find how many single walls you can walk through (remove) that shorten the best path by at least 100 units.
Full solution for today (spoilers!).
Given a comma delimited list of substrings and a list of strings, count how many of the latter strings can be made up of any (repeating) combination of the former.
Full solution for today (spoilers!).
You are given a series of points on a
71x71
grid. Taking only the first 1024 points, how long is the shortest path from(0, 0)
to(70, 70)
?
Full solution for today (spoilers!).
Implement a virtual machine. The machine will have 3 unbounded signed registers, 8 opcodes (see below), a variable parameter scheme (see below that). You will be given the initial values of the 3 registers and a program. Find the final output.
Opcode | Instruction | Description | Notes |
---|---|---|---|
0 | adv reg/val | A = A >> OP | |
1 | bxl val | B = B ^ OP | |
2 | bst reg/val | B = OP & 0b111 | |
3 | jnz val | If a =/= 0 , jump to LIT | |
4 | bxc ignore | B = B ^ C | Still takes param, but ignores it |
5 | out reg/val | Output b | Only outputs lowest 3 bits |
6 | bdv reg/val | B = A >> OP | Same as adv but writes to b |
7 | cdv reg/val | C = A >> OP | Same as adv but writes to c |
For instructions that can take reg/val
, 0
to 3
(inclusive) are treated as literal values, 4
is register A
, 5
is B
, 6
, is C
, and 7
is an error (should never happen).
For instructions that only take val
, it’s always a literal value in the range 0
to 7
(inclusive).
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.