Balloons hang over a line, each one covering an interval [start, end]. An arrow shot straight up at point x bursts every balloon with start ≤ x ≤ end, even one it only touches at the edge. Find the fewest arrows that burst all the balloons. Our example: [4, 8], [10, 12], [1, 6], [7, 9], [2, 4], [9, 11] — the answer is 3.
input
points: balloons, each [xstart, xend]: it spans the x from xstart to xend, ends included.
returns
The fewest vertical arrows that burst every balloon. An arrow shot at x bursts each balloon with xstart ≤ x ≤ xend.
constraints
1 ≤ points.length ≤ 1000
−2³¹ ≤ xstart < xend ≤ 2³¹ − 1
our 13 tests keep to them
examples
Open a test in the tests panel: it shows the input and the expected answer.