Max Queue Window

Given an array and a window size k, find the max element in each window using a deque.

Input Format

Integer n
n space-separated integers
Integer k

Output Format

List of max elements per window

Sample Input

8
1 3 -1 -3 5 3 6 7
3

Sample Output

3 3 5 5 6 7

Try Your Code

← Back to Problems List