Sliding Window Maximum · Compound Engineer

Sliding Window Maximum

Find the maximum of every window of size k in one pass. Keep a deque of indices whose values only decrease, and each element is added and removed at most once.

DSAProHardStep-through playerBy Aayush OstwalSolve on LeetCode ↗
Spotted a mistake in this lesson?Report an issue →