Cody

Solution 1866667

Submitted on 6 Jul 2019 by s Y
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))

a = 1 2 3 4 5 6 7 8 9 10 index = 1 3 5 7 9 y = 0.2749 0.3621 0.7068 0.1120 0.4459

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

a = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 90 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Columns 91 through 100 91 92 93 94 95 96 97 98 99 100 index = Columns 1 through 30 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 Columns 31 through 50 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 y = Columns 1 through 18 0.4924 0.4122 0.1282 0.5717 0.4686 0.8101 0.8341 0.3032 0.6489 0.2566 0.4295 0.6312 0.8872 0.2595 0.1326 0.0204 0.9540 0.4946 Columns 19 through 36 0.5828 0.9528 0.9965 0.9362 0.8191 0.0857 0.5299 0.9949 0.7739 0.7918 0.5411 0.6959 0.7554 0.7481 0.8652 0.5711 0.9032 0.7101 Columns 37 through 50 0.9638 0.6852 0.2487 0.4766 0.3934 0.5341 0.6144 0.2771 0.4268 0.2499 0.1447 0.7322 0.2421 0.1870

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

a = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Column 31 31 index = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 y = 'Aogiegiaaayafrwy'

Suggested Problems

More from this Author95