Great i liked this
nice
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))
y =
0.5431 0.0491 0.1399 0.9355 0.7663
|
2 | Pass |
%%
x = rand(1,100);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
y =
Columns 1 through 9
0.5421 0.3121 0.5243 0.4476 0.7419 0.0483 0.1669 0.2351 0.6620
Columns 10 through 18
0.5103 0.4978 0.3507 0.7252 0.3172 0.2033 0.3802 0.6789 0.4835
Columns 19 through 27
0.4077 0.8065 0.8456 0.1211 0.5423 0.8431 0.8814 0.9330 0.9572
Columns 28 through 36
0.1140 0.7544 0.0098 0.1420 0.7063 0.6344 0.8685 0.8188 0.3674
Columns 37 through 45
0.8321 0.2544 0.7953 0.4764 0.2311 0.1797 0.4034 0.9141 0.8974
Columns 46 through 50
0.5367 0.6461 0.2410 0.4722 0.8946
|
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))
y =
Aogiegiaaayafrwy
|
829 Solvers
495 Solvers
5467 Solvers
556 Solvers
904 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!