https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/

There are 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 will be at most 10**4 balloons.

An arrow can be shot up exactly vertically from different points along the x-axis. 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.

#### java

https://discuss.leetcode.com/topic/66579/java-greedy-soution

Java Greedy Soution

https://discuss.leetcode.com/topic/66548/concise-java-solution-tracking-the-end-of-overlapping-intervals

Concise Java solution tracking the end of overlapping intervals

https://discuss.leetcode.com/topic/70330/java-easy-to-understand-solution

Java easy to understand solution

#### cpp

https://discuss.leetcode.com/topic/66709/c-easy-understood-solution-sort

C++ easy understood solution (sort)

First, we sort balloons by increasing points.end (if ends are the same, then by increasing of points.start). Every time arrow shot points.end, say, points[i].second. If next balloon.start <= points[i].second, it is also shot, thus we continue.

https://discuss.leetcode.com/topic/66539/c-o-nlogn-solution-with-detailed-explanation

C++ O(nlogn) solution with detailed explanation

The main idea here sort the array first, and then find overlapping sequence which should cover the min(points[i].second, …, points[k].second), the operation above is insure to pick the common region from points i to points k. Time complexity is O(nlogn) for sort, and space complexity is O(n).

#### python

https://discuss.leetcode.com/topic/66772/greedy-python-132-ms

Greedy, Python (132 ms)

1. Sort intervals by ending value;
2. Only count valid intervals we need, and skip overlapping intervals

return the count