Cody

Problem 44072. Number of paths on a n-dimensional grid

Solution 1961235

Submitted on 5 Oct 2019 by Augusto Mazzei
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
NdRowVector = [3,3,3,3,3]; y_correct = 113400; assert(isequal(countNdPath(NdRowVector),y_correct))

steps = 10 pro = 1 2 6 24 120 720 5040 40320 362880 3628800 among = 10 8 6 4 among = 10 8 6 4 x = 2 2 2 2 2 total = 45 28 15 6 total = 113400

2   Pass
NdRowVector = [1,3,3,3,3,1,1,1,3,3]; y_correct = 7484400; assert(isequal(countNdPath(NdRowVector),y_correct))

steps = 12 pro = 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 among = 12 10 8 6 4 2 0 0 0 among = 12 10 8 6 4 2 1 1 1 x = 2 2 2 2 2 2 1 1 1 1 total = 66 45 28 15 6 1 1 1 1 total = 7484400

3   Pass
NdRowVector = [2,2,2,2,2,2,2,1,1,2,2,2,2]; y_correct = 39916800; assert(isequal(countNdPath(NdRowVector),y_correct))

steps = 11 pro = 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 among = 11 10 9 8 7 6 5 4 3 2 1 0 among = 11 10 9 8 7 6 5 4 3 2 1 1 x = 1 1 1 1 1 1 1 1 1 1 1 1 1 total = 11 10 9 8 7 6 5 4 3 2 1 1 total = 39916800

Suggested Problems

More from this Author9

Community Treasure Hunt

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

Start Hunting!