Question
A heart-rate monitor samples once per minute. A stretch of k consecutive minutes counts as an "active block" if its average rate is at least threshold. Given rates, the block length k (1 <= k <= number of samples), and threshold, return how many of the n - k + 1 blocks are active. Compare sums to k * threshold so everything stays in integers. Example: rates = [100, 120, 140, 90, 110], k = 2, threshold = 110 gives 3.
count_active_blocks(rates: list[int], k: int, threshold: int) → int[[100,120,140,90,110],2,110]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.