News
Days 24 and 25
Written on 25.12.2022 08:22 by Sven Rahmann
Here are some short hints for the final two days. As usual, different approaches are possible.
Day 24
This can be nicely modelled as a graph problem, where the nodes are (i, j, t), with (i, j) being the grid coordinate and t the time step. For every t, you can compute which nodes exist (i.e. which points are free). Then you can connect the graph through time. I found this problem long but not too hard if you have already solved some of the other shortest-path type problems. Part 2 is a straightforward extension. Maybe we'll do some more graph problems (from older AoC problems) in January because a large number of problems this year was graph-based.
Day 25
This is a short problem to finish. As always, part 2 is solved automatically if you have all the other 49 stars, so there is only part 1, which is a conversion between decimal numbers and a signed base-5 number system. It is similar to the DNA k-mer representation (which is a base-4 system), but with the additional twist that we have negative digits. In the end, all you need is two small functions: to_decimal(s) and to_snafu(d).