728x90
https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
if len(points) == 0:
return 0
points.sort(key = lambda x: x[1])
count = 1
end = points[0][1]
for i in range(1, len(points)):
if points[i][0] > end:
count += 1
end = points[i][1]
return count
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 1669. Merge In Between Linked Lists (0) | 2024.03.20 |
---|---|
[Leetcode] 621. Task Scheduler (0) | 2024.03.19 |
[Leetcode] 57. Insert Interval (0) | 2024.03.17 |
[Leetcode] 3083. Existence of a Substring in a String and Its Reverse (0) | 2024.03.17 |
[Leetcode] 3079. Find the Sum of Encrypted Integers (0) | 2024.03.16 |