Minimum Number of Arrows to Burst Balloons LeetCode solution in Python

1
class Solution:
2
def findMinArrowShots(self, points: List[List[int]]) -> int:
3
points.sort()
4

5
ans = [points[0]]
6
for i in points[1:]:
7
if i[0] <= ans[-1][1]:
8
ans[-1] = [ans[-1][0], min(ans[-1][1], i[1])]
9
else:
10
ans.append(i)
11
return len(ans)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0