-
Yep. Trying to expand my experience with Go as that is what I write in professionally nowadays.
Used
container/heap
for the first time on Day 17 to provide a priority queue to make implementing Dijkstra easier/faster. I normally just cobble together my own priority queue but thought this was a good time to learn how to do it properly.Nominal target of the whole year in under
1s
so I try and get each day down to under4ms
, but I'm guessing there are some days that are going to take real effort to optimise that much, and it may just be impossible for some problems. I'm slowly going back and doing all of the previous years in Go too, but that's a slightly longer project. Still have ~90 days to sort out, and I need to revisit a bunch given what I've learned over the last 2 years.[EDIT] AoC means different things to different people, there's no right or wrong way to do things.
My approach is relatively simple. I have 3 goals (with one bonus if I can be arsed):
- Goal 1: Make it work = just get the answer
- Goal 2: Make it correct = ensure the edge cases are covered, make sure it should work on any input (e.g. there's no hardcoded assumptions in there)
- Goal 3: Make it fast = understand the different approaches and find the most appropriate algorithm, but don't sacrifice understandability for tiny increments in speed
- Bonus Goal: Make it neat and tidy = really prettify it, add tests, etc
- Goal 1: Make it work = just get the answer
Did some optimisations.
Total time for 2023 so far (up to and including day 18):
0.378s