shlogg · Early preview
Rakesh Reddy Peddamallu @rakesh678219

Minimum Arrows To Burst Balloons In Intervals

Merge Intervals: Sort balloons by start pos, merge overlaps with single arrow, update last interval on overlap. Min arrows = size of merged intervals list. Time: O(n log n), Space: O(n).

Intuition

The problem requires us to find the minimum number of arrows needed to burst all balloons, given that each balloon is represented as an interval 
[start,end].
approach is based on the idea of merging overlapping intervals:

If two balloons overlap, they can be burst with a single arrow.
If they don’t overlap, a new arrow is required.

To achieve this, you sort the intervals and then iterate through them while merging overlapping balloons.
  
  
  Approach

Sort the Balloons by Start Position
First, sort the points array in ascending order of start values (a[0] - b[0]).
This ensures...