Maximum-value path through a grid
You're given a grid of payoffs. Starting at the top-left cell and moving only right or down, you must reach the bottom-right cell, collecting the value of every cell you pass through.
grid = [[1, 3, 1],
[1, 5, 1],
[4, 2, 1]]
-> 12 # path 1 -> 3 -> 5 -> 2 -> 1
Return the maximum total collectible. Aim for .
Show a hint
Every path into a cell arrives from its left neighbor or its top neighbor. What does that say about the best path into that cell?
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.