visual walkthrough
Minimum Number of Days to Make m Bouquets
Search on days, checking contiguous groups.
The idea
Flowers stay open once they bloom, so the number of bouquets you can make never goes down as days pass.
That makes "enough bouquets by day d?" a yes/no that flips once: binary search the day.
Complexity
| approach | time | space |
|---|---|---|
| Try every bloom day | O(n · d) | O(1) |
| Binary search on the day | O(n log max) | O(1) |