Cody

Problem 2773. Find the distance between runs

Solution 608993

Submitted on 31 Mar 2015 by nhagen
• Size: 9
• This is the leading solution.
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))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In rundistances (line 2) In evaluateCode', '/users/mss.system.2bvujq/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

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))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In rundistances (line 2) In evaluateCode', '/users/mss.system.2bvujq/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In rundistances (line 2) In evaluateCode', '/users/mss.system.2bvujq/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In rundistances (line 2) In evaluateCode', '/users/mss.system.2bvujq/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In rundistances (line 2) In evaluateCode', '/users/mss.system.2bvujq/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]