Source: Day 11: Reactor
Full solution for today (spoilers!).
Part 1
Given a directed graph defined where
aaa: you hhhmeansaaais connected toyouandhhh, how many paths are there fromyoutoout.
Full solution for today (spoilers!).
Given a directed graph defined where
aaa: you hhhmeansaaais connected toyouandhhh, how many paths are there fromyoutoout.
Full solution for today (spoilers!).
Given a list of numbers, for each find the two digits in the number which if concatenated make the largest. Sum these values.
For example:
811111111111119should be89.
Full solution for today (spoilers!).
You are given the edges of an undirected graph. Count how many complete subgraphs of size three exist that contain one or more starting with the letter
t.
Aside: Games with local (but not hotseat) multiplayer have gotten rather rarer over the years… how many people still know what a LAN party is/was?
Full solution for today (spoilers!).
You are trying to type a code on a keypad:
+---+---+---+ | 7 | 8 | 9 | +---+---+---+ | 4 | 5 | 6 | +---+---+---+ | 1 | 2 | 3 | +---+---+---+ | 0 | A | +---+---+But you cannot type directly. Instead, you can control a pointer on the keypad with arrow keys:
+---+---+ | ^ | A | +---+---+---+ | < | v | > | +---+---+---+Whenever you type a
^on the arrow keys, the pointer on the keypad will move up one, etc. When you typeA, then the pointer on the keypad will type whatever it is pointing at.But that’s not enough either. Add a second keypad. And then a third, that is the one you are actually controlling.
For each output sequence multiple the length of the minimum input sequence needed to generate it by the numeric value of the input sequence (ignoring any
A); sum these.Note: Moving off any keypad or into the blank spaces is an error.
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 sequence of values
v_n, replace each value with the first matching rule:
if v = 0 -> 1- If
vhas an even number of digits, split it (sov = 8675becomes[86, 75])- Otherwise,
v -> v * 2024Calculate how many elements are in the sequence after 25 iterations.
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.
Spend a month making one beautiful thing per day, given a bunch of prompts. A month late, but as they say, ’the second best time is now'.
Let’s do it!