day 18 is simple as the search space is small so for part 2 we can just
do the opposite of part 1 and scan through all empty spaces surrounding
the droplet
this is the part where the challenges start to get hard. implementing
the naive solution for part 1 did not take much time. used a hashset
since it's easier than using arrays, but slightly less performant. I
expected the naive solution would not work for part 2 due to the size of
the problem but it still worked, although it did take a few seconds to
finish. the solution i would have used if part 2 took too long would be
to trace some 45* rays from the end points of horizontal beams and
subtract the area inside from the largest sand triangle.
had a lot of issues with this one. I understood i needed dijkstra's from
the start because the second part would probably increase the complexity,
but I did not read the question enough and did not realize that we could
go down by any amount, only increases in elevation were limited. This
resulted in a lot of time being wasted on debug code to print the grid.
Cool puzzle requiring a bit of thinking for the second part. Had a lot
of issues with rust's moving system in this one, had to read some docs
again. I think I understand it better after this one.
i learnt more about how memory safety in rust works and why we need to
split a vector when mutating it in two locations to ensure they don't
conflict. makes a lot of sense to me now. also learnt that tuples can be
used in `match`, makes stuff really clean.
Have to learn how the various pointer types work for rust, this was the
main blocker preventing me from creating a recursive data structure to
store the tree.