Quant Memo
Coding/●●●●

Running minimum over a sliding window

Asked at Citadel, HRT

For a price series and window length k, report the minimum price in each window of k consecutive ticks, one value per window.

prices = [4, 2, 5, 1, 3], k = 3
-> [2, 1, 1]       # windows [4,2,5], [2,5,1], [5,1,3]

Return the list of window minima. 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