Question
A chatbot routes each user message to one of several intents, numbered 0 to num_classes - 1. The eval dashboard shows, per intent, how many messages the model routed correctly. Given equal-length lists y_true and y_pred of intent ids and the integer num_classes, return a list of length num_classes where position c holds the count of messages with y_true[i] == c and y_pred[i] == c. All ids are valid (between 0 and num_classes - 1). Example: y_true = [0, 1, 2, 1], y_pred = [0, 2, 2, 1], num_classes = 3 gives [1, 1, 1].
correct_per_class(y_true: list[int], y_pred: list[int], num_classes: int) → list[int][[0,1,2,1],[0,2,2,1],3]out[1,1,1]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.