Find Maximum in Sliding Window

Given an array of integers, find the maximum value in a window.

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

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.