Skip to main content

2136. Earliest Possible Day of Full Bloom

https://leetcode.com/problems/earliest-possible-day-of-full-bloom/

Python

Greedy

class Solution:
def earliestFullBloom(self, plantTime: List[int], growTime: List[int]) -> int:
mapper = [item for item in zip(growTime, plantTime)]
mapper.sort(key=lambda item: (-item[0], item[1]))

current, ans = 0, 0
for grow, plant in mapper:
current += plant
ans = max(ans, current+grow)
return ans