Cody

Solution 2189825

Submitted on 3 Apr 2020 by Lubos Smolik
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))

ans = 0.7879 0.2120 0.8781 0.1947 0.4780

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

ans = Columns 1 through 17 0.6782 0.6880 0.2508 0.1010 0.0246 0.6756 0.6879 0.3522 0.6197 0.3545 0.6369 0.2117 0.4149 0.8517 0.9500 0.0573 0.0011 Columns 18 through 34 0.4044 0.6467 0.6817 0.2300 0.3821 0.3896 0.7741 0.6466 0.2801 0.0812 0.4513 0.8070 0.9351 0.9700 0.5692 0.4360 0.7048 Columns 35 through 50 0.3395 0.6329 0.8730 0.8823 0.2558 0.6685 0.5363 0.7122 0.2695 0.5963 0.0046 0.9080 0.7087 0.7600 0.4397 0.4583

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

ans = 'Aogiegiaaayafrwy'

Suggested Problems

More from this Author95