Question
Not all spam-filter mistakes cost the same: quarantining a real customer email (false positive) triggers a support ticket, while letting spam through (false negative) merely annoys. Given equal-length binary lists y_true and y_pred (1 = spam), plus non-negative integer costs fp_cost and fn_cost, return the total cost: (number of positions with true 0, predicted 1) * fp_cost + (number of positions with true 1, predicted 0) * fn_cost. Example: y_true = [1, 0, 0, 1], y_pred = [0, 1, 0, 1], fp_cost = 1, fn_cost = 5 returns 6.
error_cost(y_true: list[int], y_pred: list[int], fp_cost: int, fn_cost: int) → int[[1,0,0,1],[0,1,0,1],1,5]out6State 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.