Cody

Solution 1965597

Submitted on 7 Oct 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
a = 2*3.^(1:3); b = 3*4.^(0:5); vec = [a b]; output = b; test = gSeries(vec); assert(isequal(test,output));

s = 9 y = 3 6 12 18 48 54 192 768 3072

Assertion failed.

2   Fail
a = ones(1,50); b = 3*4.^(1:5); vec = [a b]; output = a; test = gSeries(vec); assert(isequal(test,output));

s = 55 y = 1 12 48 192 768 3072

Assertion failed.

3   Fail
a = ones(1,50); b = randi(5,[1 10]); p = randperm(60); vec = [a b]; vec = vec(p); output = nonzeros(vec==1)'; test = gSeries(vec); assert(isequal(test,output));

s = 60 y = 1 2 3 4 5

Assertion failed.

4   Fail
a = 2.^(1:15); b = 3.^(1:10); c = 5.^(1:10); vec = [a b c]; p = randperm(35); vec = vec(p); output = a; test = gSeries(vec); assert(isequal(test,output));

s = 15 y = 2048 4096 8192 16384 32768

Assertion failed.

5   Pass
a = 2*3.^(1:10); vec = [a a]; p = randperm(20); vec = vec(p); output = a; test = gSeries(vec); assert(isequal(test,output));

s = 20 y = 6 18 54 162 486 1458 4374 13122 39366 118098

Suggested Problems

More from this Author44