Source: Day 21: Keypad Conundrum
Full solution for today (spoilers!).
Part 1
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.