Write a function that takes two arguments: a number
k and a list
l, and that returns another list
r such that
r[i] = min(l[i-k+1:i]).
- Input k=2, l=1,2,3,4,5,6
- Ouput r=1,1,2,3,4,5
- Input k=3, l=-1,9,7,-9,8,3,5,0,12,1,2,3,-1,-2,-3
- Ouput r=-1,-1,-1,-9,-9,-9,3,0,0,0,1,1,-1,-2,-3
Constraints: O(len(l)) time complexity. Shortest code wins.