Code RoomCanary rollout scheduling
MediumPrep Room Coding #4867

Canary rollout scheduling

CodingAlgorithms & data structuresMid–Senior~22 min

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.

Implement
min_soak_makespan(setup_minutes: list[int], soak_minutes: list[int]) → int
Examples
in[[3,1],[1,5]]out6
in[[1,5],[2,10]]out15
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 22 min
InputExpectedGot
[[3,1],[1,5]]6not run yetsample
[[1,5],[2,10]]15not run yetsample