[
greedy
intervals
sort
]
BinarySearch 0200 Hanging Banners
Problem statement
https://binarysearch.com/problems/Hanging-Banners/
Solution
Equal to Leetcode 0452. Minimum Number of Arrows to Burst Balloons.
Complexity
It is O(n log n)
for time and space.
Code
class Solution:
def solve(self, points):
points.sort(key = lambda x: x[1])
n, count = len(points), 1
if n == 0: return 0
curr = points[0]
for i in range(n):
if curr[1] < points[i][0]:
count += 1
curr = points[i]
return count