Cody

Problem 1486. Method of Common Differences part-2

Solution 3491994

Submitted on 31 Oct 2020
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
x = [1 3 2]; n=5; y_correct = [1 4 9 16 25]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

2   Fail
x = [1 4 6]; n=6; y_correct = [1 5 15 31 53 81]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

3   Fail
x = [10 -4 4]; n=7; y_correct = [10 6 6 10 18 30 46]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

4   Fail
x = [100 10 -5]; n=5; y_correct = [100 110 115 115 110]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

5   Fail
x = [0 -10 4 -2 6]; n=10; y_correct = [ 0 -10 -16 -20 -18 0 50 154 340 642]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

6   Fail
x = [3 0]; n=4; y_correct = [3 3 3 3 ]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

7   Fail
x = [6 1]; n=4; y_correct = [6 7 8 9]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

8   Fail
x = [-10 1 -5 2]; n=10; y_correct = [-10 -9 -13 -20 -28 -35 -39 -38 -30 -13]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

9   Fail
x = [ 1 3 -1 -2 2 1]; n=10; y_correct = [ 1 4 6 5 1 -3 0 22 81 202]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

10   Fail
x = [0 0 0]; n=5; y_correct = [0 0 0 0 0]; assert(isequal(commondiff2seq(x,n),y_correct))

Error in solution: Line: 4 Column: 7 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

Community Treasure Hunt

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

Start Hunting!