Code Room
CodingEasycod-g1341
Subject Ml metricsLevel Entry–Mid~10 minCommon in ML systems interviewsIndustries Software development

Question

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) → int
Examples
in[[90,40,75,60],[1,0,0,1],70]out1
What 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.

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.

Run or narrate your approach, then ask the coach.