Day 9 also required some optimizations, if you aren’t careful, you end up with really inefficient algorithms with time/memory complexity beyond what a typical machine has 🤣
#te6p5oa
(#te6p5oa) @prologic@twtxt.net How did you optimize that? 🤔
#gjx6xqq
(#te6p5oa) @movq@www.uninformativ.de I shrank Day 9 Part 2 from “cover the whole map” to “only track the interesting lines.” By compressing coordinates to just the unique x/y breakpoints, the grid got tiny. I still flood-fill and do the corner-pair checks, but now on that compact grid with weighted prefix sums for instant rectangle checks. Result: far less RAM, way less CPU, same correct answer.
#2qqbk5a