Created
October 10, 2020 16:30
-
-
Save ganesh-k13/526a7e81a20e100474b61243015305a7 to your computer and use it in GitHub Desktop.
Minimum Number of Arrows to Burst Balloons Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def findMinArrowShots(self, points: List[List[int]]) -> int: | |
if points == []: | |
return 0 | |
points.sort(key = lambda p: p[1]) | |
res = 1 | |
cur_top = points[0][1] | |
for point in points: | |
if point[0] <= cur_top: | |
continue | |
cur_top = point[1] | |
res+=1 | |
return res |
channabankapur
commented
Oct 10, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment