You are viewing a single comment's thread. Return to all comments →
cool, got to re-use code for the convex hull problem:
insert :: [Point] -> Point -> [Point] insert vs v = case vs of (x:y:z:ws) -> case orientation v x y of Up -> insert (tail vs) v _ -> v : vs _ -> v : vs convexHull :: [Point] -> [Point] convexHull = foldl' insert [] convex :: [Point] -> Bool convex xs = length xs == length (convexHull xs) concave = not . convex solve :: [Point] -> String solve xs | concave xs = "YES" | otherwise = "NO"
Seems like cookies are disabled on this browser, please enable them to open this website
Concave Polygon
You are viewing a single comment's thread. Return to all comments →
cool, got to re-use code for the convex hull problem: