Day 15: Lens Library

AdventuRust - AoC 2023

This is Day 15 of Advent of Code 2023! If you would like to solve the problems before looking at the solution, you can find them here.

In part 1 of Day 15, we have a problem that feels like a setup for part 2 because it doesn't really make much sense by itself. We have a multi-step process to obtain the hash value for multiple strings and add them up - pretty straightforward! Let's see what waits for us in part 2. Click here to jump to the part 2 discussion.

For part 2 of Day 15, we're basically making a custom HashMap. The strings that we calculated the hashes for in part 1 are insert/remove operations. It took me a while to understand what was being asked but once you figure out that the hash of the letters was used to locate the box, the rest is not too difficult. The final answer is a sum of products of some numbers from the HashMap after all the operations have been performed.

That's all folks! If you made it this far, enjoy some AI art generated by u/encse using the prompt for this puzzle.