function findMinArrowShots(points)
if length of points = 0 then
return 0
sort points by end ascending
arrows := 1
arrowPos := points[0].end
for i from 1 to length of points - 1
if points[i].start > arrowPos then
arrows := arrows + 1
arrowPos := points[i].end
return arrows
Time: . Space: extra.