Cody

Solution 1728561

Submitted on 16 Feb 2019 by Abdelfatah Teamah
  • Size: 7
  • 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
a = 2*3.^(1:3); b = 3*4.^(0:5); vec = [a b]; output = b; test = gSeries(vec); assert(isequal(test,output));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In gSeries (line 2) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In gSeries (line 2) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In gSeries (line 2) In ScoringEngineTestPoint3 (line 7) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In gSeries (line 2) In ScoringEngineTestPoint4 (line 8) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In gSeries (line 2) In ScoringEngineTestPoint5 (line 6) In solutionTest (line 11)]