Cody

Solution 1909319

Submitted on 22 Aug 2019
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   Fail
A = [30 46 16 -46 35 44 18 26 25 -10]; correct = [8 9]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 mindif = 0 0 0 0 0 mindif = 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 ind = 1 2 3 4 5 6 7 8 9 10 index1 = 1 index2 = 2

Assertion failed.

2   Fail
A = [1555 -3288 2061 -4681 -2230 -4538 -4028 3235 1949 -1829]; correct = [3 9]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 mindif = 0 0 0 0 0 mindif = 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 ind = 1 2 3 4 5 6 7 8 9 10 index1 = 1 index2 = 2

Assertion failed.

3   Pass
A = [-1 1 10 -10]; correct = [1 2]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 ind = 1 2 3 4 index1 = 1 index2 = 2

4   Fail
A = [0 1000 -2000 1001 0]; correct = [1 5]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 mindif = 0 0 0 0 0 ind = 1 2 3 4 5 index1 = 1 index2 = 2

Assertion failed.

5   Fail
A = [1:1000 0.5]; correct = [1 1001]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 mindif = 0 0 0 0 0 mindif = 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 30 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 31 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 32 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 33 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 34 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 35 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 36 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 37 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 38 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 39 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 40 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 41 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 42 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 43 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 46 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 mindif = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 52 0 0 0 0 0 0...

Assertion failed.

6   Fail
% Area codes A = [847 217 508 312 212]; correct = [2 5]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 mindif = 0 0 0 0 0 ind = 1 2 3 4 5 index1 = 1 index2 = 2

Assertion failed.

7   Fail
% Zip codes A = [60048 61802 01702 60601 10001]; correct = [1 4]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

mindif = 0 mindif = 0 0 mindif = 0 0 0 mindif = 0 0 0 0 mindif = 0 0 0 0 0 ind = 1 2 3 4 5 index1 = 1 index2 = 2

Assertion failed.