Cheapest path through a fee grid
You must move a position from the top-left cell of a grid to the bottom-right, stepping only right or down. Each cell charges a transaction fee (its value). Minimize the total fees paid, counting both endpoints.
grid = [[1, 3, 1],
[1, 5, 1],
[4, 2, 1]]
-> 7 # 1 -> 3 -> 1 -> 1 -> 1
Return the minimum total cost of a right/down path from corner to corner in O(m*n) time.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.