Question
A churn model predicts each customer's remaining subscription length in days, and the product team considers a prediction 'good enough' when it lands within a tolerance of the actual value. Given non-empty equal-length integer lists y_true and y_pred and a non-negative integer tolerance, return the number of positions where the absolute difference |y_true[i] - y_pred[i]| is less than or equal to tolerance. Example: y_true = [30, 60, 10], y_pred = [35, 80, 10], tolerance = 5 returns 2.
within_tolerance(y_true: list[int], y_pred: list[int], tolerance: int) → int[[30,60,10],[35,80,10],5]out2State 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.