func findMinArrowShots(points [][]int) int {
// 以起始点从小到大排序气球
sort.Slice(points, func(i, j int) bool {
return points[i][0] < points[j][0]
})
// 至少需要一支箭
count := 1
for i := 1; i < len(points); i++ {
// 两个气球不挨着,需要加一支箭
if points[i][0] > points[i-1][1] {
count++
} else {
// 两个气球挨着,合并气球
if points[i-1][1] < points[i][1] {
points[i][1] = points[i-1][1]
}
}
}
return count
}