Minimum Number of Arrows to Burst Balloons (Leetcode 452)
Problem Link: https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
arr=points
arr.sort(key=lambda x:x[0])
n=len(arr)
s=[arr[0]]
for i in range(1,n):
if(s[-1][1]>=arr[i][0]):
s[-1][0]=arr[i][0]
if(s[-1][1]>arr[i][1]):
s[-1][1]=arr[i][1]
else:
s.append(arr[i])
return len(s)
Last updated