Cody

Solution 575636

Submitted on 6 Feb 2015 by Alexander
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
%% v = [1,2,5,6,7,8,9,20,21,22,30,31,32,33,34,35,40,41,42,43,44]; distances = [21 5]; assert(isequal(rundistances(v),distances))

y = 1 3 8 11 17 22 en = 9 35 44 st = 5 30 40 distances = 21 5

2   Pass
%% v = [1:2:10, 14:20, 22, 23, 30:35, 37:39, 41:50, 52, 54:58, 60, 62]; distances = [30-20, 41-35, 54-50]; assert(isequal(rundistances(v),distances))

y = 1 2 3 4 5 6 13 15 21 24 34 35 40 41 42 en = 20 35 50 58 st = 14 30 41 54 distances = 10 6 4

3   Pass
%% v = [-1 5:9 14 70:76 82]; distances = [70-9]; assert(isequal(rundistances(v),distances))

y = 1 2 7 8 15 16 en = 9 76 st = 5 70 distances = 61

4   Pass
%% v = 1:100; assert(isempty(rundistances(v)))

y = 1 101 en = 100 st = 1 distances = Empty matrix: 1-by-0

5   Pass
%% v = [1:3:100]; assert(isempty(rundistances(v)))

y = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 en = Empty matrix: 1-by-0 st = Empty matrix: 1-by-0 distances = Empty matrix: 1-by-0

Suggested Problems

More from this Author9