Quant Memo
Coding/●●●●

Minimum of every sliding window

Asked at HRT, Jane Street

Given a price series and window length k, output the minimum of every contiguous window of k prices, the rolling low a market-data feed publishes each tick.

prices = [9, 7, 10, 4, 8, 6, 2, 5], k = 3
-> [7, 4, 4, 4, 2, 2]

Return all window minima in O(n)O(n) total.

Show a hint

If a newer price is lower than an older one, can the older price ever again be a window minimum?

Your answer

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

More Coding questions