Cody

Solution 1810529

Submitted on 8 May 2019 by silin yang
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))

k = 1 3 5 7 9 y = 0.6106 0.2262 0.7038 0.9473 0.3945

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

k = 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.2712 0.5692 0.1837 0.3482 0.5056 0.5257 0.9601 0.6221 0.1285 0.1844 0.5836 0.7027 0.7731 0.7882 0.6723 0.5512 0.4309 0.4460 Columns 19 through 36 0.9434 0.7571 0.8882 0.1351 0.5553 0.1586 0.1364 0.2284 0.2419 0.8182 0.6914 0.3445 0.4970 0.0284 0.2460 0.8683 0.8251 0.4445 Columns 37 through 50 0.1908 0.7533 0.1665 0.3283 0.6976 0.1634 0.8598 0.6554 0.4407 0.5749 0.1630 0.7394 0.9038 0.0769

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

k = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 y = 'Aogiegiaaayafrwy'

Suggested Problems

More from this Author95