Problem
Flower i in a garden blooms on day bloom_day[i] and stays bloomed. A bouquet needs k adjacent bloomed flowers, and each flower can go into at most one bouquet. Return the minimum number of days to wait before you can make m bouquets, or -1 if it is impossible.
Example 1
- Input
- bloom_day = [1, 10, 3, 10, 2], m = 3, k = 1
- Output
- 3
Example 2
- Input
- bloom_day = [1, 10, 3, 10, 2], m = 3, k = 2
- Output
- -1
- Why
- needs 6 flowers, only 5 exist
Example 3
- Input
- bloom_day = [7, 7, 7, 7, 12, 7, 7], m = 2, k = 3
- Output
- 12
Constraints
1 <= bloom_day.length <= 10^51 <= bloom_day[i] <= 10^91 <= m <= 10^61 <= k <= bloom_day.length