loading

Minimum Number of Arrows to Burst Balloons — Step-by-Step Visualization

mediumLeetCode #452ArrayGreedySorting

Balloons on a wall as [xstart, xend]. Arrow at x bursts all balloons with xstart<=x<=xend. Return minimum arrows needed.

Algorithm Pattern

Greedy Sort by End

Key Idea

Shoot at the earliest end point of each group of overlapping balloons.

Step-by-Step Approach

  1. Sort by right boundary
  2. Shoot first arrow at balloon[0].end
  3. For each balloon starting after current arrow, shoot new arrow at its end

Related Problems