Question
Latency Monitor

You are given an array of n integers representing response latency measurements collected from a Django application. For every contiguous subarray (sliding window) of size k, find the minimum value in that window.

Print the minimum latency for each window in the order they appear.

 

Input
Line 1: Two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the number of latency values and the window size.

Line 2: KaTeX can only parse string typed expression space-separated integers KaTeX can only parse string typed expression representing the latency values.
Output
Print KaTeX can only parse string typed expression space-separated integers — the minimum latency for each sliding window.
Example
Input
5 3

1 3 2 4 5
Output
1 2 2
Explanation
For the window [1, 3, 2], the minimum is 1. For the window [3, 2, 4], the minimum is 2. For the window [2, 4, 5], the minimum is 2. Hence, the output is '1 2 2'.

Online