Balloons are represented as intervals [xstart, xend]. An arrow shot at x bursts all balloons containing x. Find the minimum number of arrows to burst all balloons.
Greedy: sort by end. Shoot the arrow at the end of the first balloon. All overlapping balloons also burst. Move to the next unbursted balloon.
- Sort by end time.
- Shoot arrow at intervals[0][1]. Count = 1.
- For each next interval: if its start > current arrow position, shoot a new arrow at its end, count++.
- Time Complexity: O(N log N)
- Space Complexity: O(1)