mirror of
https://github.com/parnic/advent-of-code-2022.git
synced 2025-06-16 05:30:14 -05:00
1ff595a6cdaa1293ac88162c7ea351f6e1b98728
This takes the time from 20s+ to 90ms. There were 2 slow places, both LINQ shortcuts I was taking to simplify a few problems. Keeping track of the current tower height can be done without finding the highest Y out of the entire tower repeatedly per rock, which was a big chunk of slowness, and finding cycles can be done without chunking things up and comparing every single chunk, which was the other part of the slowness (I can be reasonably sure that if 3 chunks in a row match, we probably found the cycle, at least with the sample input and my input). Then a tiny amount of tuning the data to my input set (skipping 300 since it finds the loop starting at offset 309) and changing an unrolled multiplication loop into a plain multiply cleans up the last few bits.
Advent of Code 2022
My solutions to Advent of Code 2022.
Description
Languages
C#
100%