Cody

Solution 1902568

Submitted on 16 Aug 2019 by Tetsuji Tsuda
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
n = 0; correct = [1]; assert(isequal(pascalTri(n),correct))

n = 1 p = 1 flip = 1 y = 1 y = 1

2   Pass
n = 1; correct = [1 1]; assert(isequal(pascalTri(n),correct))

n = 2 p = 1 1 1 2 flip = 1 1 2 1 y = 1 1 y = 1 1

3   Pass
n = 2; correct = [1 2 1]; assert(isequal(pascalTri(n),correct))

n = 3 p = 1 1 1 1 2 3 1 3 6 flip = 1 1 1 3 2 1 6 3 1 y = 1 2 1 y = 1 2 1

4   Pass
n = 3; correct = [1 3 3 1]; assert(isequal(pascalTri(n),correct))

n = 4 p = 1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 20 flip = 1 1 1 1 4 3 2 1 10 6 3 1 20 10 4 1 y = 1 3 3 1 y = 1 3 3 1

5   Pass
n = 10; correct = [1 10 45 120 210 252 210 120 45 10 1]; assert(isequal(pascalTri(n),correct))

n = 11 p = 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 1 3 6 10 15 21 28 36 45 55 66 1 4 10 20 35 56 84 120 165 220 286 1 5 15 35 70 126 210 330 495 715 1001 1 6 21 56 126 252 462 792 1287 2002 3003 1 7 28 84 210 462 924 1716 3003 5005 8008 1 8 36 120 330 792 1716 3432 6435 11440 19448 1 9 45 165 495 1287 3003 6435 12870 24310 43758 1 10 55 220 715 2002 5005 11440 24310 48620 92378 1 11 66 286 1001 3003 8008 19448 43758 92378 184756 flip = 1 1 1 1 1 1 1 1 1 1 1 11 10 9 8 7 6 5 4 3 2 1 66 55 45 36 28 21 15 10 6 3 1 286 220 165 120 84 56 35 20 10 4 1 1001 715 495 330 210 126 70 35 15 5 1 3003 2002 1287 792 462 252 126 56 21 6 1 8008 5005 3003 1716 924 462 210 84 28 7 1 19448 11440 6435 3432 1716 792 330 120 36 8 1 43758 24310 12870 6435 3003 1287 495 165 45 9 1 92378 48620 24310 11440 5005 2002 715 220 55 10 1 184756 92378 43758 19448 8008 3003 1001 286 66 11 1 y = 1 10 45 120 210 252 210 120 45 10 1 y = 1 10 45 120 210 252 210 120 45 10 1

Suggested Problems

More from this Author95