Sliding Window Maximum
For every window of consecutive elements, print its maximum. Use a deque to get overall.
Input
, then integers, then .
Output
maxima.
Constraints
Sample 1
Input
8 1 3 -1 -3 5 3 6 7 3
Output
3 3 5 5 6 7
For every window of consecutive elements, print its maximum. Use a deque to get overall.
, then integers, then .
maxima.
Input
8 1 3 -1 -3 5 3 6 7 3
Output
3 3 5 5 6 7