This is Day 9 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 9, we're playing with derivatives, starting from first principles. The problem description is much more complicated than the actual problem - we need to create subsequent rows by calculating the step difference from the previous row, stopping once we reach a row that is all zeros. Technically, we can also stop a step earlier once we have a row where all the values are the same but I went till there was exactly one unique value in the row and the unique value was zero. The next step is to extrapolate the end of each by adding the step from the lower row onto the upper row. The sum of all the extrapolated values is the answer here. Click here to jump to the part 2 discussion.

For part 2 of Day 9, we're doing essentially the same thing but instead of appending the value to the end of the row, we're prepending it to the start of the row - we can use `insert(0, x)` instead of `push(x)` and that should solve the problem with very few other changes!

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