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.1781 0.9991 0.0326 0.8819 0.1904
|
2 | Pass |
%%
x = rand(1,100);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
ans =
Columns 1 through 10
0.4607 0.1564 0.6448 0.1909 0.4820 0.5895 0.3846 0.2518 0.6171 0.8244
Columns 11 through 20
0.7302 0.5841 0.9063 0.8178 0.5944 0.4253 0.1615 0.4229 0.5985 0.6959
Columns 21 through 30
0.6385 0.0688 0.5309 0.4076 0.7184 0.5313 0.1056 0.7788 0.0908 0.1537
Columns 31 through 40
0.4401 0.4574 0.5181 0.6377 0.2407 0.2891 0.6951 0.2548 0.6678 0.3445
Columns 41 through 50
0.6753 0.6022 0.9160 0.4624 0.4609 0.3225 0.4714 0.1759 0.4735 0.3411
|
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
|
1900 Solvers
546 Solvers
Longest run of consecutive numbers
1648 Solvers
The Answer to Life, the Universe, and Everything
383 Solvers
1077 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!