Given a matrix that represent the distance along highways between major cities numbered 1 to N, provide the path and shortest distance from a given city, from, to a given city, to. Assume that 0 represents no direct path between two cities. If there is no solution to the problem, return -1 for both the path and the distance.

Solution Stats

78 Solutions

22 Solvers

Last Solution submitted on Feb 15, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers22

Suggested Problems

More from this Author56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!