Question
A moderation model ranks the day's flagged posts from most to least suspicious, and human reviewers only get through the first k. To judge whether the top of the queue is worth their time, count the real violations there. Given ranked_labels, a list ordered by the model's ranking where 1 means the post truly violated policy and 0 means it did not, and an integer k >= 0, return the number of 1s among the first k entries. If k exceeds the list length, use the whole list. Example: ranked_labels = [1, 0, 1, 1, 0], k = 3 returns 2.
hits_in_review_budget(ranked_labels: list[int], k: int) → int[[1,0,1,1,0],3]out2State 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.