Skip to content

Commit d4a4977

Browse files
authored
Update erect-the-fence.py
1 parent 71291b7 commit d4a4977

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Python/erect-the-fence.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ def ccw(A, B, C):
1515
return (B[0]-A[0])*(C[1]-A[1]) - (B[1]-A[1])*(C[0]-A[0])
1616

1717
if len(points) <= 1:
18-
return points
18+
return points
1919

2020
hull = []
2121
points.sort()
2222
for i in itertools.chain(xrange(len(points)), reversed(xrange(len(points)-1))):
2323
while len(hull) >= 2 and ccw(hull[-2], hull[-1], points[i]) < 0:
2424
hull.pop()
2525
hull.append(points[i])
26-
hull.pop()
27-
28-
for i in xrange(1, (len(hull)+1)//2):
26+
for i in xrange(len(hull)//2):
2927
if hull[i] != hull[-1]:
3028
break
3129
hull.pop()

0 commit comments

Comments
 (0)