Problem in hackerearth problem

Please help in this question ::

Find convex hull of these points and you will get points as output of convex hull function…
Those are the points(gaurds) who will be on perimeter.
But here imo is a twist… suppose n soldiers are on perimeter of walls(colinear) the hull will only return two (will skip middle n-2 maybe)
So also add those soldiers in O(n^3) (check every point if it’s between any pair of points from output of hull)
How to find convex hull ?
Google… There are plenty of algos available…
I haven’t tried submitting it…
I may have misunderstood


Also note that above solution is lot more optimized than required… Expected solution maybe be very easy as points coordinates are only from 0 to 5… And n<32

Thanks a lot bro :slight_smile:

1 Like