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.1893 0.1483 0.7994 0.0668 0.9172
|
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.5195 0.5211 0.2230 0.5058 0.9270 0.6710 0.1413 0.0145 0.3720 0.7432
Columns 11 through 20
0.3245 0.4808 0.2107 0.9890 0.9999 0.9951 0.1693 0.3763 0.1892 0.7765
Columns 21 through 30
0.0319 0.6950 0.6863 0.4408 0.3287 0.5651 0.9658 0.8815 0.7136 0.8865
Columns 31 through 40
0.8680 0.9327 0.7835 0.0733 0.5423 0.1416 0.2083 0.5710 0.9480 0.8928
Columns 41 through 50
0.1434 0.1752 0.0256 0.6379 0.1331 0.9665 0.4982 0.3208 0.8158 0.9274
|
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
|
594 Solvers
Project Euler: Problem 1, Multiples of 3 and 5
1493 Solvers
347 Solvers
520 Solvers
556 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!