 All Problems
Minimum Number of Days to Make Bouquets
medium
binary search
array
amazon
google
facebook

You are given an integer array bloomDay, an integer m (bouquets needed), and an integer k (flowers per bouquet). You need to make m bouquets. To make a bouquet, you need to use k adjacent bloomed flowers in the garden.

Return the minimum number of days you need to wait to be able to make m bouquets. If it is impossible to make m bouquets, return -1.

Example 1:

Input: bloomDay = 1 10 3 10 2, m = 3, k = 1
Output: 3

Example 2:

Input: bloomDay = 1 10 3 10 2, m = 3, k = 2
Output: -1

Input format: First line: bloomDay array. Second line: m. Third line: k.

Output format: Minimum days, or -1 if impossible.

Run to check your code against the sample cases, or submit to run every case