Question
Two spam-filter candidates were scored on the same eval set. Each model is summarized as [tp, fp, fn]. Its F1 score is 2*tp / (2*tp + fp + fn); if 2*tp + fp + fn is 0, treat that model's F1 as 0. Return 0 if model_a has the strictly higher F1, 1 if model_b does, and -1 on an exact tie. Compare the two fractions exactly with integer cross-multiplication — do not use floating point. Example: model_a = [8, 2, 2] (F1 = 16/20) beats model_b = [9, 4, 1] (F1 = 18/23), so return 0.
better_f1(model_a: list[int], model_b: list[int]) → int[[8,2,2],[9,4,1]]out0State 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.