Day 16 solution

Following the formula for part 1 was straightforward enough, but finding the pattern for part 2 and deducing the shortcut formula took me a while. That first 0 1 propagate enough that by the time we get halfway through applying the formula, it's all 0s and 1s, so sort of like an addition with a mask on what numbers we're adding.

Also, fun fact: changing the numberSet from an array of ints (my initial implementation) to an array of int8's (what's here now) reduced the memory footprint of the application substantially (from something like 50mb to closer to 8).
This commit is contained in:
2022-06-30 08:03:18 -05:00
parent f0be3f9f98
commit ec27a5ec6c
7 changed files with 110 additions and 0 deletions

View File

@ -46,6 +46,7 @@ var dayMap = []day{
&days.Day13{},
&days.Day14{},
&days.Day15{},
&days.Day16{},
}
func main() {