This is Day 11 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 11, we are calculating pairwise Manhattan distance between a given set of coordinates. The extra step is that certain rows and columns are duplicated if they are comprised solely of dots. Ideally I should have taken a different approach to this and stored the indices of the rows and columns but I just decided to loop through and duplicate rows and columns when encountered. By this point in this year's edition of AOC, I can guess what to expect for Part 2, and I was exactly right - but that's for part 2. The sum of the pairwise distances gives you the answer for part 1. Click here to jump to the part 2 discussion.

For part 2 of Day 11, we have a multiplier for the empty rows and columns - instead of doubling, the rows and columns are multiplied by a million. We can no longer generate a matrix where we replace the empty rows and columns by the new set, so part 2 needed a bit of refactoring. Instead of creating gigantic vectors, I now keep track of the indices for empty rows and columns and if a path has to intersect these rows and columns, I add the multiplier to the distance. The rest of the problem is the same as part 1.

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

Cheers,

Devang