Search
⌘K

Leetcode 239. Sliding Window Maximum

Given an integer array and a window size k, return the maximum value for each contiguous subarray (sliding window) as it moves one step to the right. With n up to 1e5, this requires an O(n) approach typically implemented with a monotonic deque to maintain candidate maxima.

Asked at:

Microsoft

Microsoft

Meta

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid February, 2026

Microsoft

Microsoft

Mid-level

Mid November, 2025

Microsoft

Microsoft

Mid-level

Early May, 2025

Meta

Mid-level

Comments

Your account is free and you can post anonymously if you choose.