n seeds. Each one has to be sown first; then it grows and blooms.
- Sowing seed i takes sow_days[i] full days of work. Each day you work on exactly one seed; the days spent on one seed need not be consecutive, but sowing is done only once sow_days[i] days have gone into it.
- Once sown, the seed grows for grow_days[i] full days, then blooms and stays in bloom for good.
Work starts at the beginning of day 0 and the seeds may be sown in any order. Return the earliest day on which every seed is in bloom.sow_days=[2, 1, 3], grow_days=[1, 5, 2] → 7
Sow flower 1 first (day 0); it blooms on day 6. Then flower 2 (days 1–3), blooming on day 6. Then flower 0 (days 4–5), blooming on day 7. Nothing beats 7: sowing alone takes 6 days and the last flower still needs at least a day to grow.
sow_days=[4], grow_days=[3] → 7
Sowing takes days 0–3 and growing 3 more days, so it blooms on day 7.
sow_days=[1, 1, 1], grow_days=[2, 2, 2] → 5
sow_days=[2, 1, 3], grow_days=[1, 5, 2]
7
Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.