Skip to main content

452. Minimum Number of Arrows to Burst Balloons

https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons

Python

class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
if not points:
return 0

points.sort(key=lambda point: point[0])

cur = points[-1][0]
points.pop()
counter = 1

while points:
if cur <= points[-1][1]:
points.pop()
continue

point = points.pop()
cur = point[0]
counter += 1

return counter