Question
The moderation team wants to know the model's single worst confusion: which (true category, predicted category) mistake happens most often. Given equal-length string lists y_true and y_pred, consider only the positions where the two differ. Count the occurrences of each ordered (true, predicted) pair and return the count of the most frequent pair. If the model made no mistakes (or the lists are empty), return 0. Example: y_true = ["spam", "ok", "spam", "toxic", "spam"], y_pred = ["ok", "ok", "ok", "spam", "ok"] returns 3 (the pair spam predicted as ok).
top_confusion(y_true: list[str], y_pred: list[str]) → int[["spam","ok","spam","toxic","spam"],["ok","ok","ok","spam","ok"]]out3State 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.