Cody

Solution 2082924

Submitted on 7 Jan 2020 by Nicola Dellino
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 = rand(1,10); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

v = 1 v = 2 v = 3 v = 4 v = 5 v = 6

2   Pass
x = rand(1,100); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

v = 1 v = 2 v = 3 v = 4 v = 5 v = 6 v = 7 v = 8 v = 9 v = 10 v = 11 v = 12 v = 13 v = 14 v = 15 v = 16 v = 17 v = 18 v = 19 v = 20 v = 21 v = 22 v = 23 v = 24 v = 25 v = 26 v = 27 v = 28 v = 29 v = 30 v = 31 v = 32 v = 33 v = 34 v = 35 v = 36 v = 37 v = 38 v = 39 v = 40 v = 41 v = 42 v = 43 v = 44 v = 45 v = 46 v = 47 v = 48 v = 49 v = 50 v = 51

3   Pass
x = ['A' 'long' 'time' 'ago' 'in' 'a' 'galaxy' 'far' 'far' 'away']; actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

v = 1 v = 2 v = 3 v = 4 v = 5 v = 6 v = 7 v = 8 v = 9 v = 10 v = 11 v = 12 v = 13 v = 14 v = 15 v = 16 v = 17

Suggested Problems

More from this Author95