452 Minimum Number of Arrows to Burst Balloons
There are a number of spherical balloons spread in twodimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it’s horizontal, ycoordinates don’t matter and hence the xcoordinates of start and end of the diameter suffice. Start is always smaller than end. There will be at most 104 balloons.
An arrow can be shot up exactly vertically from different points along the xaxis. A balloon with xstart and xend bursts by an arrow shot at x if xstart ≤ x ≤ xend. There is no limit to the number of arrows that can be shot. An arrow once shot keeps travelling up infinitely. The problem is to find the minimum number of arrows that must be shot to burst all balloons.
Example:


思路
将气球排序，维护一个指向当前气球最小结束值的指针。当一个气球的起始值大于该最小结束值，将该气球置为当前气球。然后将之前的气球戳爆！


参考资料和测试用例：
[[3,9],[7,12],[3,8],[6,8],[9,10],[2,9],[0,9],[3,9],[0,6],[2,8]]
[[9,12],[1,10],[4,11],[8,12],[3,9],[6,9],[6,7]]
https://discuss.leetcode.com/topic/72901/aconcisetemplateforoverlappingintervalproblem