Consider an $m \times n$ matrix and I want to find the cheapest path from $a_{1,1}$ to $a_{m,n}$, given one can only move right or down.
Is there any algorithm to calculate this? What would be the most efficient way to do this?
Edit: Matrix entries are considered to be the cost of one step.
For eg: the following matrix has the cheapest cost of $(10+2+2+2+3) = 19$
\begin{bmatrix} 10 & 5 & 6 \\ 2 & 4 & 7 \\ 2 & 2 & 3 \end{bmatrix}
One method is Dijkstra's_algorithm under: https://en.wikipedia.org/wiki/Dynamic_programming
I think you can use smallest cost instead of shortest path in your example.