'''
解题思路:
区间不断合并,没有交集时,需要一支箭
'''
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
P = points
n = len(points)
P = sorted(P,key=lambda x:x[0])
print(P)
S = P[0]
k = 0
for i in range(1,n):
N = P[i]
if N[0]<=S[1]:
S = [N[0],min(S[1],N[1])]
else:
k += 1
S = N
return k+1
points = [[10,16],[2,8],[1,6],[7,12]] # 2
points = [[1,2],[3,4],[5,6],[7,8]] # 4
points = [[1,2],[2,3],[3,4],[4,5]] # 2
points = [[1,2]] # 1
points = [[2,3],[2,3]] # 1
t = Solution().findMinArrowShots(points)
print(t)