Code Room
CodingEasycod-g1343
Subject Ml metricsLevel Entry–Mid~10 minCommon in ML systems · Algorithms & data structures interviewsIndustries Software development

Question

A churn model predicts, for each at-risk subscriber, how many days until they cancel. The retention dashboard reports the model's average miss in whole days. Given non-empty equal-length lists y_true and y_pred of integer day counts, compute the sum of absolute differences |y_true[i] - y_pred[i]|, divide by the number of subscribers, and return the result rounded down to an integer. Example: y_true = [10, 20, 30], y_pred = [12, 18, 33] has absolute misses 2, 2, 3 summing to 7, so return floor(7 / 3) = 2.

Implement
avg_miss_days(y_true: list[int], y_pred: list[int]) → int
Examples
in[[10,20,30],[12,18,33]]out2
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.