Cody

Solution 1247234

Submitted on 7 Aug 2017 by xinyu lei
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.2120 0.1704 0.7492 0.3569 0.7413

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

ans = Columns 1 through 18 0.5706 0.4516 0.2451 0.4573 0.8051 0.0237 0.9289 0.3949 0.2898 0.1656 0.3175 0.1993 0.9845 0.7408 0.8997 0.2392 0.4774 0.7581 Columns 19 through 36 0.0551 0.2460 0.3725 0.1839 0.0501 0.9936 0.3662 0.9067 0.7290 0.3202 0.6338 0.4720 0.8806 0.3952 0.2492 0.5914 0.5609 0.4385 Columns 37 through 50 0.9041 0.5574 0.3933 0.2755 0.9686 0.5134 0.3050 0.8567 0.0277 0.3101 0.7066 0.5792 0.8373 0.7254

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