There is a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since It's horizontal, y-coordinates don ' t matter and hence the x-coordinates of start and end of the diameter suffice. Start is always smaller than end. There'll is at the most 104 balloons.
An arrow can is shot up exactly vertically from different points along the x-axis. A balloon with Xstart and xend bursts to an arrow shot at x if Xstart≤x≤xend. There is no limit to the number of arrows it can be shot. An arrow once shot keeps travelling up infinitely. The problem is to find the minimum number of arrows this must be shot to burst all balloons.
Example:
Input: [[10,16], [2,8], [1,6], [7,12]] Output:2Explanation:one to shoot one arrow for example at x = 6 (Bursting the balloons [2,8] and [1,6]) and another arrow at x = one (bursting the other and balloons).
S
[Leetcode] Minimum number of Arrows to Burst balloons a minimum amount of arrows to detonate balloons