Skip to content

Commit

Permalink
Time: 1038 ms (65.69%) | Memory: 62.7 MB (80.82%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ShatilKhan committed Mar 18, 2024
1 parent 349991e commit 4a8218b
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
points.sort(key=lambda x: x[0])
arrows = 1
end = points[0][1]

for balloon in points[1:]:
if balloon[0] > end:
arrows += 1
end = balloon[1]
else:
end = min(end, balloon[1])

return arrows

0 comments on commit 4a8218b

Please sign in to comment.