01 · Question
Counting Subarrays (At-Most-K)
Given an array of sales, count the number of subarrays with at most k bad days (days with fewer than 10 sales).
Key Insight: If a window [l, r] is valid (has <= k bad days), then all subarrays ending at r within this window (i.e., starting from l, l+1, ..., r) are also valid. There are r - l + 1 such subarrays.