Problem · Array
Sliding Window Maximum
Learn this problemProblem statement
Given an integer array nums and a window size k, return the maximum value in every contiguous window of length k, from left to right.
Function
maxSlidingWindow(nums: int[], k: int) → int[]Examples
Example 1
nums = [1,3,-1,-3,5,3,6,7]k = 3return = [3,3,5,5,6,7]Example 2
nums = [1]k = 1return = [1]More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026