Sliding Window Maximum | Monotonic Stack
We have an array and a sliding window defined by a start index and an end index. The sliding window moves from left of the array to right. There are always k elements in the window. The window moves one position at a time. Find the maximum integer within the window each time it moves.
Input:
arr = [1, 3, 2, 5, 8, 7] k = 3
Output:
[3, 5, 8, 8]
