Question
Before reading any experiment result, a healthy A/B pipeline checks for sample-ratio mismatch: did each variant actually receive its intended share of traffic? Given counts (observed visitors per variant), expected_pct (intended percentage per variant, same length), and an integer tolerance tol_pct, let total be the sum of counts. Variant i is flagged when |100 * counts[i] - expected_pct[i] * total| > tol_pct * total, using exact integer arithmetic. Return the flagged indices in increasing order. If total is 0, return an empty list. Example: counts = [560, 440], expected_pct = [50, 50], tol_pct = 2 returns [0, 1].
srm_flags(counts: list[int], expected_pct: list[int], tol_pct: int) → list[int][[560,440],[50,50],2]out[0,1]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.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.