Cody

# Problem 1049. Path of least resistance

Solution 1675726

Submitted on 17 Nov 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
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 ]; y_correct = 35; assert(isequal(shortest_path(M),y_correct))

r = 1 c = 1 p = 0 p = 8 r = 2 c = 2 p = 9 r = 3 c = 3 p = 11 r = 4 c = 4 p = 12 c = 5 p = 22 c = 6 p = 31 c = 7 p = 35 c = 8

2   Fail
M = [6 8 5 5 3 5 4 8 0 5 9 6 9 3 2 3 1 1 2 6 8 1 6 8 3 ]; y_correct = 22; assert(isequal(shortest_path(M),y_correct))

r = 1 c = 1 p = 3 p = 9 r = 2 c = 2 p = 13 r = 3 p = 19 r = 4 p = 20 r = 5 p = 21 c = 3 p = 27 c = 4 p = 35 c = 5

Assertion failed.

3   Fail
M = hadamard(8); y_correct = -5; assert(isequal(shortest_path(M),y_correct))

r = 1 c = 1 p = -1 p = 0 r = 2 c = 2 p = -1 r = 3 c = 3 p = -2 r = 4 p = -3 r = 5 p = -2 r = 6 c = 4 p = -3 r = 7 p = -4 c = 5 p = -5 r = 8 p = -6 c = 6 p = -5 c = 7 p = -4 c = 8

Assertion failed.