Cody

Solution 1821895

Submitted on 21 May 2019
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   Fail
n = 0; correct = [1]; assert(isequal(pascalTri(n),correct))

x = []

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in pascalTri (line 3) y=x(n,:) Error in Test1 (line 3) assert(isequal(pascalTri(n),correct))

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

x = 1 y = 1

Assertion failed.

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

x = 1 1 1 2 y = 1 2

Assertion failed.

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

x = 1 1 1 1 2 3 1 3 6 y = 1 3 6

Assertion failed.

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

x = 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 1 3 6 10 15 21 28 36 45 55 1 4 10 20 35 56 84 120 165 220 1 5 15 35 70 126 210 330 495 715 1 6 21 56 126 252 462 792 1287 2002 1 7 28 84 210 462 924 1716 3003 5005 1 8 36 120 330 792 1716 3432 6435 11440 1 9 45 165 495 1287 3003 6435 12870 24310 1 10 55 220 715 2002 5005 11440 24310 48620 y = 1 10 55 220 715 2002 5005 11440 24310 48620

Assertion failed.