Code RoomEarly stopping rule
MediumPrep Room Coding #555

Early stopping rule

CodingAlgorithms & data structuresEntry–Mid~14 min

Your team runs a simple sequential rule for calling growth experiments early. Both arms get equal traffic every day. Given control_daily and variant_daily — equal-length lists of daily conversion counts — and integers lead and min_days, find the first day d (1-based) on which BOTH conditions hold: d >= min_days, and the cumulative variant conversions through day d exceed the cumulative control conversions through day d by at least lead. Return that day number, or -1 if no day qualifies. Example: control_daily = [10, 12, 11], variant_daily = [14, 15, 16], lead = 10, min_days = 2 returns 3 (cumulative lead reaches 12).

Implement
first_significant_day(control_daily: list[int], variant_daily: list[int], lead: int, min_days: int) → int
Examples
in[[10,12,11],[14,15,16],10,2]out3
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 14 min
InputExpectedGot
[[10,12,11],[14,15,16],10,2]3not run yetsample