Earliest Possible Day of Full Bloom
specialist · 980 · lc hard +32 · verified · 71.2% accepted · 1,674 likes · top 80%
Description
You have n flower seeds to plant and grow. Each seed must first be planted before it can grow and bloom. You are given two 0-indexed integer arrays plantTime and growTime, each of length n:
- plantTime[i] is the total number of days needed to finish planting seed i. Each day you can work on only one seed, but days do not need to be consecutive. Planting is complete after plantTime[i] total work days.
- growTime[i] is the number of days seed i takes to grow once fully planted. After its growth period ends, the flower blooms permanently.
Starting from day 0, you may plant seeds in any order.
Return the earliest day on which all flowers are simultaneously blooming.
Example 1:
Example 2:
Example 3:
Code