Rolling median across a sliding window
Asked at Citadel Securities
Given a series and a window size k, report the median of each consecutive window of k values as the window slides one step at a time. The median is more robust to outlier prints than the mean.
nums = [1, 3, -1, -3, 5, 3, 6, 7], k = 3
-> [1, -1, -1, 3, 5, 6]
Return the list of window medians.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.