Cody

Problem 42938. Project Euler: Problem 18, Maximum path sum I

Solution 2210178

Submitted on 14 Apr 2020 by Jiawei Gong
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
x = [3 0 0 0 7 4 0 0 2 4 6 0 8 5 9 3]; assert(isequal(maxPathSum(x),23))

2   Pass
assert(isequal(maxPathSum(tril(magic(10))),891))

3   Pass
assert(isequal(maxPathSum(tril(magic(100)^2)),251716502500))

4   Pass
assert(isequal(maxPathSum(tril(mod(magic(1000),997))),741570))

5   Pass
assert(isequal(maxPathSum(tril(gallery('integerdata',1e4,5e3,4))),37455089))

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!