Advent of Code 2023 - Day 8

Опубликовано: 07 Октябрь 2024
на канале: Jonathan Paulson
8,048
92

I placed 64th in part 1; 220th in part 2; still 2nd overall.

The input for part 2 was constructed very nicely so that each cycle hits 'Z' at every multiple of the cycle length, so the answer is just the lcm of the cycle lengths. In fully generic input, they could have some offset (e.g. cycle 0 hits 'Z' at times a+b*k for all integers k), in which case you could solve the problem with the Chinese remainder theorem.

Tough day for me. I just need some more sleep I think :)