Cody

# Problem 51. Find the two most distant points

Solution 1601697

Submitted on 6 Aug 2018 by Deepthi Palagati
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))

len = 4 c = 1 m = 1 n = 2 c = 2.8284 m = 1 n = 3 c = 1 c = 2.2361 c = 1.4142 c = 2.2361 ix = 1 3

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

len = 4 c = 1 m = 1 n = 2 c = 2.8284 m = 1 n = 3 c = 10 m = 1 n = 4 c = 2.2361 c = 10.0499 m = 2 n = 4 c = 8.2462 ix = 2 4

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

len = 2 c = 50.0100 m = 1 n = 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))

len = 6 c = 6.4031 m = 1 n = 2 c = 4.2426 c = 7.0711 m = 1 n = 4 c = 106.0660 m = 1 n = 5 c = 1.0705e+03 m = 1 n = 6 c = 2.2361 c = 10.0499 c = 102.9612 c = 1.0761e+03 m = 2 n = 6 c = 8.2462 c = 103.5761 c = 1.0744e+03 c = 100.4988 c = 1.0734e+03 c = 1.1638e+03 m = 5 n = 6 ix = 5 6

### Community Treasure Hunt

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

Start Hunting!