Given an integer array `arr` and an integer `k`, find the maximum value in each sliding window of size `k`. The output is an array of these maximums. Solved in O(n) time using a monotonic deque.
arr = array of integers, k = window size
array of integers (maximum of each subarray)
Example 1:
Input:
arr = [1,3,-1,-3,5,3,6,7] k = 3
Output:
[3,3,5,5,6,7]
Example 2:
Input:
arr = [1,2,3,1,4,5,2,3,6] k = 3
Output:
[3,3,4,5,5,5,6]