Cody

# Problem 51. Find the two most distant points

Solution 367987

Submitted on 10 Dec 2013 by Robert
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
%% p = [0 0; 1 0; 2 2; 0 1]; ix_correct = [1 3]; assert(isequal(mostDistant(p),ix_correct))

max = 0 r = 4 c = 2 diff = 1 max = 1 ix = 1 2 diff = 4 max = 4 ix = 1 3 diff = 1 diff = 3 diff = 2 diff = 3

2   Pass
%% p = [0 0; 1 0; 2 2; 0 10]; ix_correct = [2 4]; assert(isequal(mostDistant(p),ix_correct))

max = 0 r = 4 c = 2 diff = 1 max = 1 ix = 1 2 diff = 4 max = 4 ix = 1 3 diff = 10 max = 10 ix = 1 4 diff = 3 diff = 11 max = 11 ix = 2 4 diff = 10

3   Pass
%% p = [0 0; -1 50]; ix_correct = [1 2]; assert(isequal(mostDistant(p),ix_correct))

max = 0 r = 2 c = 2 diff = 51 max = 51 ix = 1 2

4   Pass
%% p = [5 5; 1 0; 2 2; 0 10; -100 20; 1000 400]; ix_correct = [5 6]; assert(isequal(mostDistant(p),ix_correct))

max = 0 r = 6 c = 2 diff = 9 max = 9 ix = 1 2 diff = 6 diff = 10 max = 10 ix = 1 4 diff = 120 max = 120 ix = 1 5 diff = 1390 max = 1390 ix = 1 6 diff = 3 diff = 11 diff = 121 diff = 1399 max = 1399 ix = 2 6 diff = 10 diff = 120 diff = 1396 diff = 110 diff = 1390 diff = 1480 max = 1480 ix = 5 6