Churn prediction MAE
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]) → intExamples
in
[[10,20,30],[12,18,33]]out2What 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
[[10,20,30],[12,18,33]]2not run yetsample