Trains the technique from
LeetCode 452Minimum Number of Arrows to Burst BalloonsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A rail operator has to sign off a list of track segments. The i-th entry of points gives that segment as a pair [start_i, end_i], meaning the segment covers every milepost from start_i to end_i with both ends included.
An inspection is booked at one integer milepost x. Booking it signs off every segment that covers x, so a segment is signed off when start_i <= x <= end_i. Any milepost may be chosen and any number of inspections may be booked.
Return the smallest number of inspections that signs off every segment on the list.
Example 1
Booking mileposts 3, 8 and 12 signs off all four segments: milepost 3 covers [1, 3] and [2, 5], milepost 8 covers [4, 8], and milepost 12 covers [9, 12]. No pair of mileposts reaches all four.
Example 2
Both segments cover milepost 2, since the ends of a segment are included, so a single booking there signs off both.
Example 3
Booking milepost 3 signs off [1, 10] and [2, 3], and booking milepost 5 signs off [4, 5]. A single booking cannot cover both [2, 3] and [4, 5], which share no milepost.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def find_min_arrow_shots(points: list[list[int]]) -> int:public int findMinArrowShots(int[][] points)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.