Cody

# Problem 51. Find the two most distant points

Solution 661849

Submitted on 27 Apr 2015 by Li Yjie
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))

a = 4 max = 0 dis = 1 max = 1 k = 1 2 dis = 8 max = 8 k = 1 3 dis = 1 dis = 5 dis = 2 dis = 5

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

a = 4 max = 0 dis = 1 max = 1 k = 1 2 dis = 8 max = 8 k = 1 3 dis = 100 max = 100 k = 1 4 dis = 5 dis = 101 max = 101 k = 2 4 dis = 68

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

a = 2 max = 0 dis = 2501 max = 2501 k = 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))

a = 6 max = 0 dis = 41 max = 41 k = 1 2 dis = 18 dis = 50 max = 50 k = 1 4 dis = 11250 max = 11250 k = 1 5 dis = 1146050 max = 1146050 k = 1 6 dis = 5 dis = 101 dis = 10601 dis = 1158001 max = 1158001 k = 2 6 dis = 68 dis = 10728 dis = 1154408 dis = 10100 dis = 1152100 dis = 1354400 max = 1354400 k = 5 6