Problem
Balloons are taped to a wall. Balloon i spans the horizontal range points[i] = [x_start, x_end]. An arrow shot straight up at position x bursts every balloon with x_start <= x <= x_end, and keeps flying. Return the minimum number of arrows needed to burst all the balloons.
Example 1
- Input
- [[10, 16], [2, 8], [1, 6], [7, 12]]
- Output
- 2
- Why
- shoot at 6 and at 11
Example 2
- Input
- [[1, 2], [3, 4], [5, 6], [7, 8]]
- Output
- 4
Example 3
- Input
- [[1, 2], [2, 3], [3, 4], [4, 5]]
- Output
- 2
- Why
- shoot at 2 and at 4
Constraints
1 <= points.length <= 10^5-2^31 <= x_start < x_end <= 2^31 - 1