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.
I encounted similar issue when trying to implement Graham scan algorithm. It appeared that I did not handle collinear case properly.
In your case, your points do not create hull for test #4, as there are several points outside polygon, e.g. point [116 3] is outside segment [[44 3] - [26 3]] though all the three points belongs to a line.
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 →
I encounted similar issue when trying to implement Graham scan algorithm. It appeared that I did not handle collinear case properly. In your case, your points do not create hull for test #4, as there are several points outside polygon, e.g. point [116 3] is outside segment [[44 3] - [26 3]] though all the three points belongs to a line.