Clean sample windows
A telemetry pipeline marks a dropped sample as 0; every genuine reading is nonzero. Quality reports need to know how many windows of k consecutive samples are completely clean — containing no dropped samples at all. Given readings and k (1 <= k <= number of samples), return that count. Track how many zeros are inside the current window instead of rescanning each window. Example: readings = [3, 0, 4, 5, 6], k = 2 gives 2 ([4,5] and [5,6]).
Implement
count_clean_windows(readings: list[int], k: int) → intExamples
in
[[3,0,4,5,6],2]out2What 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.
0:00 of about 11 min
solution.py
InputExpectedGot
[[3,0,4,5,6],2]2not run yetsample