Stealth Interview
  • Features
  • Pricing
  • Blog
  • Login
  • Sign up

Leetcode #1482: Minimum Number of Days to Make m Bouquets

In this guide, we solve Leetcode #1482 Minimum Number of Days to Make m Bouquets in Python and focus on the core idea that makes the solution efficient.

You will see the intuition, the step-by-step method, and a clean Python implementation you can use in interviews.

Leetcode

Problem Statement

You are given an integer array bloomDay, an integer m and an integer k. You want to make m bouquets.

Quick Facts

  • Difficulty: Medium
  • Premium: No
  • Tags: Array, Binary Search

Intuition

The problem structure suggests a monotonic decision, which makes binary search a natural fit.

By halving the search space each step, we reach the answer efficiently.

Approach

Search either directly on a sorted array or on the answer space using a check function.

Each check is fast, and the logarithmic search keeps the overall runtime low.

Steps:

  • Define the search bounds.
  • Check the mid point condition.
  • Narrow the bounds until convergence.

Example

Input: bloomDay = [1,10,3,10,2], m = 3, k = 1 Output: 3 Explanation: Let us see what happened in the first three days. x means flower bloomed and _ means flower did not bloom in the garden. We need 3 bouquets each should contain 1 flower. After day 1: [x, _, _, _, _] // we can only make one bouquet. After day 2: [x, _, _, _, x] // we can only make two bouquets. After day 3: [x, _, x, _, x] // we can make 3 bouquets. The answer is 3.

Python Solution

class Solution: def minDays(self, bloomDay: List[int], m: int, k: int) -> int: def check(days: int) -> int: cnt = cur = 0 for x in bloomDay: cur = cur + 1 if x <= days else 0 if cur == k: cnt += 1 cur = 0 return cnt >= m mx = max(bloomDay) l = bisect_left(range(mx + 2), True, key=check) return -1 if l > mx else l

Complexity

The time complexity is O(n×log⁡M)O(n \times \log M)O(n×logM), where nnn and MMM are the number of flowers in the garden and the maximum blooming day, respectively. The space complexity is O(1)O(1)O(1).

Edge Cases and Pitfalls

Watch for boundary values, empty inputs, and duplicate values where applicable. If the problem involves ordering or constraints, confirm the invariant is preserved at every step.

Summary

This Python solution focuses on the essential structure of the problem and keeps the implementation interview-friendly while meeting the constraints.


Ace your next coding interview

We're here to help you ace your next coding interview.

Subscribe
Stealth Interview
© 2026 Stealth Interview®Stealth Interview is a registered trademark. All rights reserved.
Product
  • Blog
  • Pricing
Company
  • Terms of Service
  • Privacy Policy