Problem 51. Find the two most distant points
Solution Stats
Problem Comments
-
7 Comments
More easy that it seems.
You need to specify "Euclidean" distance :-)
Good problem, not too hard but required thinking
Please add the next test :
p = [0,0;
2,1;
2,6;
1,6];
ix_correct = [1 3];
assert(isequal(mostDistant(p),ix_correct))
The solutions of the form:
[~,indx]=max(dist(p'));
unique(indx)
will fail, the last line will return an extra index [1,3,4] instead of just [1,3]
refer to
Convex Hull therom and the Graham's Scan method
+1
Nice one!
Solution Comments
Show commentsProblem Recent Solvers2534
Suggested Problems
-
Find the alphabetic word product
3075 Solvers
-
How to find the position of an element in a vector without using the find function
2654 Solvers
-
How long is the longest prime diagonal?
384 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
360 Solvers
-
3025 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!