Cody

Problem 2672. Largest Geometric Series

Solution 1965557

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));

t = 1 2 3 1 4 2 5 8 9

Output argument "y" (and maybe others) not assigned during call to "gSeries". Error in Test1 (line 5) test = gSeries(vec);

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

t = Columns 1 through 29 1 2 3 4 5 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 Columns 30 through 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55

Output argument "y" (and maybe others) not assigned during call to "gSeries". Error in Test2 (line 5) test = gSeries(vec);

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));

t = Columns 1 through 29 3 3 3 1 2 2 3 3 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 Columns 30 through 58 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 Columns 59 through 60 60 60

Output argument "y" (and maybe others) not assigned during call to "gSeries". Error in Test3 (line 7) test = gSeries(vec);

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));

t = Columns 1 through 29 1 2 3 4 1 1 2 2 5 3 3 4 6 4 5 6 5 7 7 8 6 9 8 7 10 11 8 9 12 Columns 30 through 35 9 13 10 14 10 15

Output argument "y" (and maybe others) not assigned during call to "gSeries". Error in Test4 (line 8) test = gSeries(vec);

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

t = 2 2 4 4 6 6 8 8 10 10 12 12 14 14 16 16 18 18 20 20

Output argument "y" (and maybe others) not assigned during call to "gSeries". Error in Test5 (line 6) test = gSeries(vec);