Minimum Number of Days to Make m Bouquets

Med
Concept
Code
Loading editor...
Tap Analyze to see visualization
Variables

Run code to see variables

Output

Console output will appear here

Press Space to start to step? all shortcuts

Solution Guide: Minimum Number of Days to Make m Bouquets

Approach

Binary search the number of days. For each day, count adjacent bloomed flowers in streaks and whether they form at least m bouquets of size k.

Complexity Analysis

Time
O(n log W) where W is bloom day range
Space
O(1)

Pattern

Binary Search on Answer

Why It Works

As days increase, feasibility is monotonic. If we can make bouquets by day d, we can also do so at any d+1.

Updated Feb 2026