Minimum Number of Arrows to Burst Balloons
Problem Statement
Balloons are taped to a wall. Each balloon is given only by where it spans along the x-axis: [x_start, x_end].
You can shoot arrows straight up from any point x. An arrow at x bursts every balloon with x_start ≤ x ≤ x_end, and keeps flying.
Return the fewest arrows needed to burst all the balloons.
Note that an arrow exactly on the edge counts: an arrow at x = 2 bursts both [1, 2] and [2, 3].
An array points where points[i] = [x_start, x_end].
One integer: the minimum number of arrows.
An arrow at x = 6 bursts [2,8] and [1,6]. An arrow at x = 11 bursts [10,16] and [7,12].
No two balloons share any point, so each needs its own arrow.
An arrow at x = 2 bursts [1,2] and [2,3]. An arrow at x = 4 bursts [3,4] and [4,5].
- • 1 ≤ points.length ≤ 10^5
- • points[i].length == 2
- • −2^31 ≤ x_start < x_end ≤ 2^31 − 1
Pattern Recognition Clues
Recognising these key signals in the problem description immediately identifies the pattern:
Approach Complexity Ladder
Try every subset of balloon end points as arrow spots; keep the smallest that bursts all
Each round: scan for the earliest end still flying, shoot there, burst everything it touches
Sort by end; shoot a new arrow at a balloon's end only when it starts after the last arrow
Only balloon ends are worth shooting at: slide any arrow right until it reaches the first end among the balloons it bursts, and it still bursts all of them. So collect the distinct ends, try every subset of them, and keep the smallest subset that hits every balloon.
Recognition rule for this sub-pattern:
Unlock Complete Visual Walkthrough & Optimal C++
The interactive animated dry-run player, optimized C++ implementation, state invariant derivations, and edge-case breakdown for this question are part of Brute2Best Pro. The anchor question of every sub-pattern is completely free.
First anchor question per pattern, Part 1 LLD & Module 1 C++ basics are 100% Free forever.
How this concept connects to System Design & C++ Systems
Top engineering interviews test whether you understand how algorithms like Intervals translate into production architectures and low-level memory mechanics.
Foundations: Object-Oriented Principles in C++23
Class invariants, pure virtual interfaces, and RAII smart pointers.
Food Delivery System (Zomato Architecture)
Real-world machine coding application of algorithms and design patterns.
Pointers vs References Deep Dive
Pointer arithmetic and memory layout under the hood.
Virtual Method Table (vtable) & Memory Layout
Polymorphism, vptr overhead, and multiple inheritance in memory.