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

Leetcode #2136: Earliest Possible Day of Full Bloom

In this guide, we solve Leetcode #2136 Earliest Possible Day of Full Bloom 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 have n flower seeds. Every seed must be planted first before it can begin to grow, then bloom.

Quick Facts

  • Difficulty: Hard
  • Premium: No
  • Tags: Greedy, Array, Sorting

Intuition

A locally optimal choice leads to a globally optimal result for this structure.

That means we can commit to decisions as we scan without backtracking.

Approach

Sort or preprocess if needed, then repeatedly take the best available local choice.

Maintain the minimal state necessary to validate the greedy decision.

Steps:

  • Sort or preprocess as needed.
  • Iterate and pick the best local option.
  • Track the current solution.

Example

Input: plantTime = [1,4,3], growTime = [2,3,1] Output: 9 Explanation: The grayed out pots represent planting days, colored pots represent growing days, and the flower represents the day it blooms. One optimal way is: On day 0, plant the 0th seed. The seed grows for 2 full days and blooms on day 3. On days 1, 2, 3, and 4, plant the 1st seed. The seed grows for 3 full days and blooms on day 8. On days 5, 6, and 7, plant the 2nd seed. The seed grows for 1 full day and blooms on day 9. Thus, on day 9, all the seeds are blooming.

Python Solution

class Solution: def earliestFullBloom(self, plantTime: List[int], growTime: List[int]) -> int: ans = t = 0 for pt, gt in sorted(zip(plantTime, growTime), key=lambda x: -x[1]): t += pt ans = max(ans, t + gt) return ans

Complexity

The time complexity is O(nlog⁡n)O(n \log n)O(nlogn), and the space complexity is O(n)O(n)O(n), where nnn is the number of seeds. The space complexity is O(n)O(n)O(n), where nnn is the number of seeds.

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