Imagine you're defending a castle with a bow and arrow! ๐ฐ There are spherical balloons floating at different heights along a wall, and you need to burst all of them using the minimum number of arrows.
Each balloon is represented by an interval [x_start, x_end] showing its horizontal span on the wall. When you shoot an arrow vertically at position x, it will burst all balloons whose intervals contain that point (where x_start โค x โค x_end).
Your mission: Find the minimum number of arrows needed to burst all balloons!
Example: If you have balloons at [[10,16], [2,8], [1,6], [7,12]], you can burst them all with just 2 arrows - one at position 6 (hits balloons [2,8] and [1,6]) and another at position 11 (hits balloons [10,16] and [7,12]).
Input & Output
Constraints
- 1 โค points.length โค 105
- points[i].length == 2
- -231 โค xstart < xend โค 231 - 1
- All balloon coordinates are valid integers