Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short (10 lines) solution in Creative category for Convex Hull by StefanPochmann
# migrated from python 2.7
def checkio(d):
h, i = sorted(d) + sorted(d)[::-1], 1
while i < len(h):
(a,A), (b,B), (c,C) = (h*2)[i-1:i+2]
if (b,B) == (c,C) or (c-a)*(B-A) < (b-a)*(C-A):
h.pop(i)
i -= i > 1
else:
i += 1
return list(map(d.index, h))
April 29, 2015
Comments: