Objective
In a grid with a cost on each square you go from the top left corner to the bottom right one moving only right or down. The best cost of a square is its cost plus the smaller of the best costs of the square above and the one to the left.
Instructions
- The first line has rows
fand columnsc; thenflines withcintegers. - Show
Minimum cost: xwith the minimum sum of costs of the path (including both corners).
3 3
1 3 1
1 5 1
4 2 1
Minimum cost: 7
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise