Module day02

Source
Expand description

ยง1202 Program Alarm

Substituting symbols instead of numbers into the program shows that it calculates the value of

a * noun + b * verb + c

We can isolate the value of the constants a, b, c in order to speed up subsequent calculations.

As the equation is monotonically increasing in both noun and verb, we can efficiently solve part two by binary searching in two dimensions, instead of a slow brute force check of all possible 10,000 combinations.

Functionsยง

check ๐Ÿ”’
execute ๐Ÿ”’
parse
part1
part2
search ๐Ÿ”’

Type Aliasesยง

Input ๐Ÿ”’