Minimum Number of Days to Make m Bouquets

Medium · Binary Search · about 20 minutes

Asked at Amazon, Google, Bloomberg, Meta.

Flower i opens on day bloomDay[i]. Making one bouquet takes k open flowers that sit next to each other, and a flower can go into one bouquet only. What is the earliest day by which m bouquets can be made? Return -1 if there are too few flowers.

Related guides