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

Question

A content-moderation model labels posts with integer category ids. The weekly report shows accuracy as a whole percent, rounded down. Given equal-length lists y_true and y_pred, count the positions where they agree and return floor(100 * correct / total) as an integer. If the lists are empty, return 0. Example: y_true = [1, 0, 2, 1], y_pred = [1, 0, 1, 1] has 3 of 4 correct, so return 75.

Implement
accuracy_percent(y_true: list[int], y_pred: list[int]) → int
Examples
in[[1,0,2,1],[1,0,1,1]]out75
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.