Quant Memo
Coding/●●●●●

Count windows whose average beats a threshold

Given a series of values and a window length k, count how many windows of k consecutive values have a mean strictly greater than a threshold T.

values = [1, 2, 3, 4], k = 2, T = 2.5
-> 1            # only [3, 4] has mean 3.5

Return the number of qualifying windows. Aim for O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions