Skip to content
LC-2136 Hard LeetCode

2136. Earliest Possible Day of Full Bloom

Read the full problem statement on LeetCode.
Difficulty: hard Acceptance: 71% Topics: Array, Greedy, Sorting
View full problem on LeetCode
Reference solution (spoiler · python)
# Time:  O(nlogn)
# Space: O(n)

class Solution(object):
    def earliestFullBloom(self, plantTime, growTime):
        """
        :type plantTime: List[int]
        :type growTime: List[int]
        :rtype: int
        """
        order = range(len(growTime))
        order.sort(key=lambda x: growTime[x], reverse=True)
        result = curr = 0
        for i in order:
            curr += plantTime[i]
            result = max(result, curr+growTime[i])
        return result

Solution from kamyu104/LeetCode-Solutions · MIT