-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Here's my solution, I really liked today's challenge. After solving part 2 I rewrote part 1 to use the same code that finds the basins. The code turned out to be very useful and the final solution is quite nice and succint.
After a few false starts I found grid and it's so well-suited for the problem that the solution ended up being really elegant, IMO. The full solution is here but the meat of it is this function that turns a rectangular grid of squares mapped to Int into a grid of the same shape to Maybe (Point, Int). The value this function returns just needs some sorting, groupBy, and catMaybe.