Code RoomMinimum delivery factor
HardPrep Room Coding #4923

Minimum delivery factor

CodingAlgorithms & data structuresSenior–Staff~42 min

A render farm runs one batch a night on a single machine and never idles between jobs. Job i was submitted at minute submitted_at[i] and needs render_minutes[i] of machine time, always at least one minute. The batch begins at minute start_at, by which point every job is queued. The contract promises each customer delivery by their own submission minute plus factor times their own render minutes, so a heavy job is allowed proportionally more room than a light one. The farm may run the batch in whatever order it likes. Return the smallest whole factor for which some order delivers every job on time, and 0 for an empty batch. Note that the promised times, and therefore the order they suggest, move as the factor moves.

Implement
smallest_slowdown_factor(submitted_at: list[int], render_minutes: list[int], start_at: int) → int
Examples
in[[0,30,40],[20,3,2],40]out5
in[[0,0],[5,5],0]out2
in[[0,10,20],[6,6,6],20]out5
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 42 min
InputExpectedGot
[[0,30,40],[20,3,2],40]5not run yetsample
[[0,0],[5,5],0]2not run yetsample
[[0,10,20],[6,6,6],20]5not run yetsample