Sliding Window Maximum

Here is an array and a window of size k = 3. Your job: find the maximum of each window as it slides across.

Find the Maximums

Array: 13-1-35367, window size k = 3. Step through each window. Starting from the second, predict whether the max will change before seeing the answer.

1
0
3
1
-1
2
-3
3
5
4
3
5
6
6
7
7

Window [0..2]: [1, 3, -1]