Minimum days for bouquets

Write codeMedium24 min

Your task

You have a garden where bloom[i] is the day the i-th flower blooms. To make a bouquet you need k adjacent (consecutive in the array) bloomed flowers; you want to make m bouquets. Return the minimum number of days to wait so you can make m bouquets, or -1 if it is impossible. 1 <= len(bloom) <= 1e5.

Examples

min_days_bouquets(bloom: list[int], m: int, k: int) -> int
Example 1
Inputmin_days_bouquets([1, 10, 3, 10, 2], 3, 1)
Output3