Cody

# Problem 1486. Method of Common Differences part-2

Solution 1535048

Submitted on 20 May 2018 by J. S. Kowontan
• Size: 20
• This is the leading solution.
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
x = [1 3 2]; n=5; y_correct = [1 4 9 16 25]; assert(isequal(commondiff2seq(x,n),y_correct))

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

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

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

5   Pass
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))

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

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

8   Pass
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))

9   Pass
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))

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