Search⌘ K
AI Features

Solution: Minimum Number of Days to Make m Bouquets

C# solution for the Minimum Number of Days to Make m Bouquets problem using the Modified Binary Search pattern.

Statement

You are given an integer array bloomDay, where bloomDay[i] is the day the ith flower blooms.

You want to make exactly m bouquets. Each bouquet must consist of exactly k flowers that are adjacent in the array, and each flower can be used in at most one bouquet.

Return the minimum day such that it is possible to make m bouquets by that day. If it is impossible to make m bouquets, return 1-1.

Note: A flower is considered available on day d if bloomDay[i] \leq d.

Constraints:

  • bloomDay.length == n

  • 11 \leq n 105\leq 10^5 ...