Cody

Problem 51. Find the two most distant points

Solution 1419327

Submitted on 18 Jan 2018 by Ajay Rawat
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))

b = 1 b2 = 1 b2 = 8 ix = 1 3 b = 8 b2 = 1 b2 = 0 b2 = 5 b2 = 2 b2 = 5 b2 = 0 b2 = 5

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

b = 1 b2 = 1 b2 = 8 ix = 1 3 b = 8 b2 = 100 ix = 1 4 b = 100 b2 = 0 b2 = 5 b2 = 101 ix = 2 4 b = 101 b2 = 5 b2 = 0 b2 = 68

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

b = 2501 b2 = 2501

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))

b = 41 b2 = 41 b2 = 18 b2 = 50 ix = 1 4 b = 50 b2 = 11250 ix = 1 5 b = 11250 b2 = 1146050 ix = 1 6 b = 1146050 b2 = 0 b2 = 5 b2 = 101 b2 = 10601 b2 = 1158001 ix = 2 6 b = 1158001 b2 = 5 b2 = 0 b2 = 68 b2 = 10728 b2 = 1154408 b2 = 101 b2 = 68 b2 = 0 b2 = 10100 b2 = 1152100 b2 = 10601 b2 = 10728 b2 = 10100 b2 = 0 b2 = 1354400 ix = 5 6 b = 1354400

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!