Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 55057

Submitted on 2 Mar 2012

Incorrect

35Size
Leading solution size is 37.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
a = [1 5 3 11 7 2 4 9];
stride = 2;
assert(isequal(skip_sequence_stride(a),stride))
Error: Undefined function 'dist' for input arguments of type 'double'.
2
Fail
 
%%
a = [1:5:20 23:3:42 2:9:100];
stride = 9;
assert(isequal(skip_sequence_stride(a),stride))
Error: Undefined function 'dist' for input arguments of type 'double'.
3
Fail
 
%%
a = [2:2:22 13:17];
a = a(randperm(length(a)));
stride = 2;
assert(isequal(skip_sequence_stride(a),stride))
Error: Undefined function 'dist' for input arguments of type 'double'.
4
Fail
 
%%
a = 37:5:120;
a = a(randperm(length(a)));
stride = 5;
assert(isequal(skip_sequence_stride(a),stride))
Error: Undefined function 'dist' for input arguments of type 'double'.
5
Fail
 
%%
a = [1:5 101:10:171 201:205];
a = a(randperm(length(a)));
stride = 10;
assert(isequal(skip_sequence_stride(a),stride))
Error: Undefined function 'dist' for input arguments of type 'double'.
6
Fail
 
%%
a = [7:17:302 primes(300)];
a = sort(a);
stride = 17;
assert(isequal(skip_sequence_stride(a),stride))
Error: Undefined function 'dist' for input arguments of type 'double'.