class Solution:
def findMinArrowShots(self, A: List[List[int]]) -> int:
"""
time O(NlgN) space O(1)
0. check edge case if points is empty
1. sort by end point
2. cache 1st end, start looping with 2nd
3. current start ptr > end s cnt +1
note here if end with start overlaps, one arrow will be fine
"""
"""
convert problem into find the most overlaped points
=> need to shoot right most as possible =>sort by end
"""
if not A:
return 0
A.sort(key=lambda x:x[1])
end = A[0][1]
cnt = 1
for s,e in A:
if s <= end: #can be skipped, just to make clear
continue
else:
# if s > end
cnt += 1
end = e
return cnt