Question
Given y_true (binary labels 0/1) and scores (real-valued classifier scores, higher means more likely positive), compute the ROC-AUC using the trapezoidal rule over thresholds. Sort the unique candidate thresholds, and for each, classify a point as positive when score >= threshold. Build the ROC curve as (FPR, TPR) points including the endpoints (0,0) and (1,1), sort by FPR ascending (breaking ties by TPR), and integrate the area under the curve with the trapezoidal rule. Return the AUC rounded to 4 decimal places. There is at least one positive and one negative label; length up to 2000.
roc_auc(y_true: list[int], scores: list[float]) → float[[1,1,0,0],[0.9,0.6,0.4,0.1]]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.