Find Maximum in Sliding Window
Given an array of integers, find the maximum value in a window.
We'll cover the following...
Statement
Given an integer array and a window of size w
, find the current maximum value in the window as it slides through the entire array.
Note: If the window size is greater than the array size, we will consider the entire array as a single window.
Example
Sample input
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
window_size = 3
Expected output
[3, 4, 5, 6, 7, 8, 9, 10]
Try it yourself
...Access this course and 1400+ top-rated courses and projects.