Problem 45457. Minimal Path - 02
Given a matrix, find the minimal path from the top left to the bottom right by only moving to the right and down so that the summation is minimum.
Use linear index to show the path.
For example,
x=[ 2 2 2 2 2 10 10 10 1 2 20 20 20 1 2 30 30 30 30 2]
The minimal path is -- [1 5 9 13 14 15 19 20]
Solution Stats
Problem Comments
-
5 Comments
William,
I've commented out the last test suite.
can u kindly point out the other path u're getting?
The alternate path is:
[1 11 21 22 32 42 43 44 45 55 56 66 76 77 78 79 89 90 100]
Here's another alternate path for the last test suite (magic(10)).
[1 2 3 13 14 24 34 35 45 55 56 57 58 68 69 70 80 90 100]
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
Convert Roman to Arabic Numerals
109 Solvers
-
Solve the set of simultaneous linear equations
437 Solvers
-
Sum of first n terms of a harmonic progression
452 Solvers
-
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
1919 Solvers
-
Golomb's self-describing sequence (based on Euler 341)
165 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!