Spam filter false positives
A spam filter outputs an integer risk score from 0 to 100 per email, and any email with score >= threshold gets quarantined. Legal wants to know how many legitimate emails would be quarantined at a proposed threshold. Given equal-length lists scores and labels (label 1 = spam, 0 = legitimate) and an integer threshold, return the number of false positives: emails whose label is 0 and whose score is greater than or equal to threshold. Example: scores = [90, 40, 75, 60], labels = [1, 0, 0, 1], threshold = 70 gives 1.
Implement
false_positives_at(scores: list[int], labels: list[int], threshold: int) → intExamples
in
[[90,40,75,60],[1,0,0,1],70]out1What 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 10 min
solution.py
InputExpectedGot
[[90,40,75,60],[1,0,0,1],70]1not run yetsample