Canary rollout scheduling

Write codeMedium22 min

Your task

One release engineer rolls out canaries by hand. Canary i needs setup_minutes[i] of the engineer's undivided attention, and once its setup ends it soaks unattended for soak_minutes[i] before it counts as clear. The engineer starts at minute zero, runs the setups back to back in any order chosen, and never pauses. Soaks overlap freely because nobody watches them, so a canary is clear at its own setup end plus its soak length, and the rollout is finished when every canary is clear. Return the earliest minute the rollout can finish. Both lists have the same length, every value is at least one, and with no canaries the rollout finishes at minute 0. Setting up the quickest canary first does not minimise this.

Examples

min_soak_makespan(setup_minutes: list[int], soak_minutes: list[int]) -> int
Example 1
Inputmin_soak_makespan([3, 1], [1, 5])
Output6
Example 2
Inputmin_soak_makespan([1, 5], [2, 10])
Output15