Cody

# Problem 51. Find the two most distant points

Solution 332785

Submitted on 11 Oct 2013 by Zikobrelli
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 = 0 1 4 0 1 0 1 1 4 1 0 4 0 1 4 0 a2 = 0 0 4 1 0 0 4 1 4 4 0 1 1 1 1 0 mat = 0 1 8 1 1 0 5 2 8 5 0 5 1 2 5 0 iy = 3 1 ix = 1 3 ix = 1 3

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

a = 0 1 4 0 1 0 1 1 4 1 0 4 0 1 4 0 a2 = 0 0 4 100 0 0 4 100 4 4 0 64 100 100 64 0 mat = 0 1 8 100 1 0 5 101 8 5 0 68 100 101 68 0 iy = 4 2 ix = 2 4 ix = 2 4

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

a = 0 1 1 0 a2 = 0 2500 2500 0 mat = 0 2501 2501 0 iy = 2 1 ix = 1 2 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))

a = 0 16 9 25 11025 990025 16 0 1 1 10201 998001 9 1 0 4 10404 996004 25 1 4 0 10000 1000000 11025 10201 10404 10000 0 1210000 990025 998001 996004 1000000 1210000 0 a2 = 0 25 9 25 225 156025 25 0 4 100 400 160000 9 4 0 64 324 158404 25 100 64 0 100 152100 225 400 324 100 0 144400 156025 160000 158404 152100 144400 0 mat = 0 41 18 50 11250 1146050 41 0 5 101 10601 1158001 18 5 0 68 10728 1154408 50 101 68 0 10100 1152100 11250 10601 10728 10100 0 1354400 1146050 1158001 1154408 1152100 1354400 0 iy = 6 5 ix = 5 6 ix = 5 6

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!