Cody

Solution 1925244

Submitted on 7 Sep 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   Pass
user_solution = fileread('pascalMat.m'); assert(isempty(strfind(user_solution,'regexp'))); assert(isempty(strfind(user_solution,'2str'))); assert(isempty(strfind(user_solution,'str2'))); assert(isempty(strfind(user_solution,'interp'))); assert(isempty(strfind(user_solution,'printf'))); assert(isempty(strfind(user_solution,'assert')));

2   Fail
n = 0; P_correct = [ 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 0×1 empty double column vector

Assertion failed.

3   Fail
n = 1; P_correct = [ 1 0 1 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1

Assertion failed.

4   Fail
n = 2; P_correct = [ 1 0 0 1 1 0 1 2 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 1 -1

Assertion failed.

5   Fail
n = 3; P_correct = [ 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 1 -1 0 1 -2 1

Assertion failed.

6   Fail
n = 4; P_correct = [ 1 0 0 0 0 1 1 0 0 0 1 2 1 0 0 1 3 3 1 0 1 4 6 4 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 1 -1 0 0 1 -2 1 0 1 -3 3 -1

Assertion failed.

7   Fail
n = 5; P_correct = [ 1 0 0 0 0 0 1 1 0 0 0 0 1 2 1 0 0 0 1 3 3 1 0 0 1 4 6 4 1 0 1 5 10 10 5 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 1 -1 0 0 0 1 -2 1 0 0 1 -3 3 -1 0 1 -4 6 -4 1

Assertion failed.

8   Fail
n = 6; P_correct = [ 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 2 1 0 0 0 0 1 3 3 1 0 0 0 1 4 6 4 1 0 0 1 5 10 10 5 1 0 1 6 15 20 15 6 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 1 -1 0 0 0 0 1 -2 1 0 0 0 1 -3 3 -1 0 0 1 -4 6 -4 1 0 1 -5 10 -10 5 -1

Assertion failed.

9   Fail
n = 7; P_correct = [ 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 2 1 0 0 0 0 0 1 3 3 1 0 0 0 0 1 4 6 4 1 0 0 0 1 5 10 10 5 1 0 0 1 6 15 20 15 6 1 0 1 7 21 35 35 21 7 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 1 -1 0 0 0 0 0 1 -2 1 0 0 0 0 1 -3 3 -1 0 0 0 1 -4 6 -4 1 0 0 1 -5 10 -10 5 -1 0 1 -6 15 -20 15 -6 1

Assertion failed.

10   Fail
n = 8; P_correct = [ 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 1 4 6 4 1 0 0 0 0 1 5 10 10 5 1 0 0 0 1 6 15 20 15 6 1 0 0 1 7 21 35 35 21 7 1 0 1 8 28 56 70 56 28 8 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 1 -3 3 -1 0 0 0 0 1 -4 6 -4 1 0 0 0 1 -5 10 -10 5 -1 0 0 1 -6 15 -20 15 -6 1 0 1 -7 21 -35 35 -21 7 -1

Assertion failed.

11   Fail
n = 9; P_correct = [ 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 1 6 15 20 15 6 1 0 0 0 1 7 21 35 35 21 7 1 0 0 1 8 28 56 70 56 28 8 1 0 1 9 36 84 126 126 84 36 9 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 1 -6 15 -20 15 -6 1 0 0 1 -7 21 -35 35 -21 7 -1 0 1 -8 28 -56 70 -56 28 -8 1

Assertion failed.

12   Fail
n = 10; P_correct = [ 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 0 1 6 15 20 15 6 1 0 0 0 0 1 7 21 35 35 21 7 1 0 0 0 1 8 28 56 70 56 28 8 1 0 0 1 9 36 84 126 126 84 36 9 1 0 1 10 45 120 210 252 210 120 45 10 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 0 1 -6 15 -20 15 -6 1 0 0 0 1 -7 21 -35 35 -21 7 -1 0 0 1 -8 28 -56 70 -56 28 -8 1 0 1 -9 36 -84 126 -126 84 -36 9 -1

Assertion failed.

13   Fail
n = 11; P_correct = [ 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 0 0 1 6 15 20 15 6 1 0 0 0 0 0 1 7 21 35 35 21 7 1 0 0 0 0 1 8 28 56 70 56 28 8 1 0 0 0 1 9 36 84 126 126 84 36 9 1 0 0 1 10 45 120 210 252 210 120 45 10 1 0 1 11 55 165 330 462 462 330 165 55 11 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 0 0 1 -6 15 -20 15 -6 1 0 0 0 0 1 -7 21 -35 35 -21 7 -1 0 0 0 1 -8 28 -56 70 -56 28 -8 1 0 0 1 -9 36 -84 126 -126 84 -36 9 -1 0 1 -10 45 -120 210 -252 210 -120 45 -10 1

Assertion failed.

14   Fail
n = 12; P_correct = [ 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 0 0 0 1 6 15 20 15 6 1 0 0 0 0 0 0 1 7 21 35 35 21 7 1 0 0 0 0 0 1 8 28 56 70 56 28 8 1 0 0 0 0 1 9 36 84 126 126 84 36 9 1 0 0 0 1 10 45 120 210 252 210 120 45 10 1 0 0 1 11 55 165 330 462 462 330 165 55 11 1 0 1 12 66 220 495 792 924 792 495 220 66 12 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 0 0 0 1 -6 15 -20 15 -6 1 0 0 0 0 0 1 -7 21 -35 35 -21 7 -1 0 0 0 0 1 -8 28 -56 70 -56 28 -8 1 0 0 0 1 -9 36 -84 126 -126 84 -36 9 -1 0 0 1 -10 45 -120 210 -252 210 -120 45 -10 1 0 1 -11 55 -165 330 -462 462 -330 165 -55 11 -1

Assertion failed.

15   Fail
n = 13; P_correct = [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 0 0 0 0 1 6 15 20 15 6 1 0 0 0 0 0 0 0 1 7 21 35 35 21 7 1 0 0 0 0 0 0 1 8 28 56 70 56 28 8 1 0 0 0 0 0 1 9 36 84 126 126 84 36 9 1 0 0 0 0 1 10 45 120 210 252 210 120 45 10 1 0 0 0 1 11 55 165 330 462 462 330 165 55 11 1 0 0 1 12 66 220 495 792 924 792 495 220 66 12 1 0 1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 0 0 0 0 1 -6 15 -20 15 -6 1 0 0 0 0 0 0 1 -7 21 -35 35 -21 7 -1 0 0 0 0 0 1 -8 28 -56 70 -56 28 -8 1 0 0 0 0 1 -9 36 -84 126 -126 84 -36 9 -1 0 0 0 1 -10 45 -120 210 -252 210 -120 45 -10 1 0 0 1 -11 55 -165 330 -462 462 -330 165 -55 11 -1 0 1 -12 66 -220 495 -792 924 -792 495 -220 66 -12 1

Assertion failed.

16   Fail
n = 14; P_correct = [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 0 0 0 0 0 1 6 15 20 15 6 1 0 0 0 0 0 0 0 0 1 7 21 35 35 21 7 1 0 0 0 0 0 0 0 1 8 28 56 70 56 28 8 1 0 0 0 0 0 0 1 9 36 84 126 126 84 36 9 1 0 0 0 0 0 1 10 45 120 210 252 210 120 45 10 1 0 0 0 0 1 11 55 165 330 462 462 330 165 55 11 1 0 0 0 1 12 66 220 495 792 924 792 495 220 66 12 1 0 0 1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1 0 1 14 91 364 1001 2002 3003 3432 3003 2002 1001 364 91 14 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 0 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 0 0 0 0 0 1 -6 15 -20 15 -6 1 0 0 0 0 0 0 0 1 -7 21 -35 35 -21 7 -1 0 0 0 0 0 0 1 -8 28 -56 70 -56 28 -8 1 0 0 0 0 0 1 -9 36 -84 126 -126 84 -36 9 -1 0 0 0 0 1 -10 45 -120 210 -252 210 -120 45 -10 1 0 0 0 1 -11 55 -165 330 -462 462 -330 165 -55 11 -1 0 0 1 -12 66 -220 495 -792 924 -792 495 -220 66 -12 1 0 1 -13 78 -286 715 -1287 1716 -1716 1287 -715 286 -78 13 -1

Assertion failed.

17   Fail
n = 15; P_correct = [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 3 1 0 0 0 0 0 0 0 0 0 0 0 0 1 4 6 4 1 0 0 0 0 0 0 0 0 0 0 0 1 5 10 10 5 1 0 0 0 0 0 0 0 0 0 0 1 6 15 20 15 6 1 0 0 0 0 0 0 0 0 0 1 7 21 35 35 21 7 1 0 0 0 0 0 0 0 0 1 8 28 56 70 56 28 8 1 0 0 0 0 0 0 0 1 9 36 84 126 126 84 36 9 1 0 0 0 0 0 0 1 10 45 120 210 252 210 120 45 10 1 0 0 0 0 0 1 11 55 165 330 462 462 330 165 55 11 1 0 0 0 0 1 12 66 220 495 792 924 792 495 220 66 12 1 0 0 0 1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1 0 0 1 14 91 364 1001 2002 3003 3432 3003 2002 1001 364 91 14 1 0 1 15 105 455 1365 3003 5005 6435 6435 5005 3003 1365 455 105 15 1 ]; assert(isequal(pascalMat(n),P_correct));

P = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 -3 3 -1 0 0 0 0 0 0 0 0 0 0 0 1 -4 6 -4 1 0 0 0 0 0 0 0 0 0 0 1 -5 10 -10 5 -1 0 0 0 0 0 0 0 0 0 1 -6 15 -20 15 -6 1 0 0 0 0 0 0 0 0 1 -7 21 -35 35 -21 7 -1 0 0 0 0 0 0 0 1 -8 28 -56 70 -56 28 -8 1 0 0 0 0 0 0 1 -9 36 -84 126 -126 84 -36 9 -1 0 0 0 0 0 1 -10 45 -120 210 -252 210 -120 45 -10 1 0 0 0 0 1 -11 55 -165 330 -462 462 -330 165 -55 11 -1 0 0 0 1 -12 66 -220 495 -792 924 -792 495 -220 66 -12 1 0 0 1 -13 78 -286 715 -1287 1716 -1716 1287 -715 286 -78 13 -1 0 1 -14 91 -364 1001 -2002 3003 -3432 3003 -2002 1001 -364 91 -14 1

Assertion failed.

Suggested Problems

More from this Author18