Post

An adventure in reading comprehension — I had an off-by-one error in my counts because I was counting *success* and not *attempts*.

0 reposts0 likes

Part 2 is my slowest performing JS code so far in this advent, running in about 300ms on my laptop. Might try to dig in and see if there are optimizations to be made... later!

One thing I noticed this time: the answers worked more as "checksums" that you'd done the right calculation, rather than meaningful parts of the puzzle. Would have been nice for the answer to tie back to the question, e.g. the length of wire needed for the elves to complete the circuits?

One optimization of note, switching to a basic PriorityQueue (sort as you build) instead of building then sorting the list by distance helped drop runtime from ~300 to ~90ms.