We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 044cd57 commit 9d884edCopy full SHA for 9d884ed
leetcode.com 452. Minimum Number of Arrows to Burst Balloons/main.py
@@ -0,0 +1,19 @@
1
+from typing import List
2
+
3
4
+class Solution:
5
+ def findMinArrowShots(self, points: List[List[int]]) -> int:
6
+ answer = len(points)
7
+ points.sort(key=lambda x: x[0])
8
+ prev = points[0]
9
10
+ for idx in range(1, len(points)):
11
+ crnt = points[idx]
12
13
+ if crnt[0] <= prev[1]:
14
+ answer -= 1
15
+ prev = [crnt[0], min(prev[1], crnt[1])]
16
+ else:
17
+ prev = crnt
18
19
+ return answer
0 commit comments