Problem 1049. Path of least resistance
Find the length of the shortest path through the matrix from the top left to bottom right corner. You may move right, down, or diagonally right-down one element at a time. The length of the path is the sum of the elements you pass through.
E.g.
M = [*8 6 10 10 4 7 7 7
9 *1 10 5 9 0 8 2
1 3 *2 8 8 8 7 7
9 5 10 *1 *10 *9 *4 *0 ];
>> shortest_path(M)
ans =
35
The shortest path through this matrix has length 35. Each element along the path is marked with a *
Solution Stats
Problem Comments
-
1 Comment
Zikobrelli
on 10 Feb 2014
Cool problem. Optimal solutions sometimes appear if moving up is enabled.
Solution Comments
Show commentsGroup

Board Games II
- 14 Problems
- 10 Finishers
- High Precision Square Root (Inspired by Project Euler 80)
- Damping of Servomotors with Tachometer Feedback
- Find the right number make the equation
- Deriving a function using the difference quotient
- Fast 1-D Convolution (full shape)
- Fast 1-D Convolution (same shape)
- Fast 1-D Convolution (valid shape)
- Lambert's W
- First use of arrayfun() and anonymous function @(x)
- Cell Operator *
- Product of two multivariate polynomials
- Multivariate polynomials - convert monomial form to array
- Multivariate polynomials - overload multiplication
- Multivariate polynomials - emulate symbolic form
- Rewrite setdiff to account for non-unique values
Problem Recent Solvers74
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!