We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It selects an "extreme" point, i.e. one that's assuredly on the perimeter, then for each point it finds the next point that's the smallest angular distance from the previous point.
This solution is a bit brute force insofar as for each step it considers all other points as possibilities for an angle check. It succeeds on 4 out of 5 of the test data sets but times out on the last one.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Convex Hull
You are viewing a single comment's thread. Return to all comments →
Here's my homebrewed Clojure solution:
It selects an "extreme" point, i.e. one that's assuredly on the perimeter, then for each point it finds the next point that's the smallest angular distance from the previous point.
This solution is a bit brute force insofar as for each step it considers all other points as possibilities for an angle check. It succeeds on 4 out of 5 of the test data sets but times out on the last one.