Question
A growth experiment ships only if the variant wins the primary metric without wrecking a guardrail. Each arm is given as [conversions, visitors, unsubscribes] with visitors >= 1. Declare the variant the winner (return 1) exactly when both hold, using integer arithmetic only: (1) its conversion rate is strictly higher: variant_conv * control_visitors > control_conv * variant_visitors; and (2) its unsubscribe rate does not exceed control's by more than margin_bps basis points: 10000 * (variant_unsub * control_visitors - control_unsub * variant_visitors) <= margin_bps * control_visitors * variant_visitors. Otherwise return 0. Example: control = [50, 1000, 10], variant = [70, 1000, 12], margin_bps = 30 returns 1.
declare_winner(control: list[int], variant: list[int], margin_bps: int) → int[[50,1000,10],[70,1000,12],30]out1State 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.