Back to DSA sheet

Sliding Window Maximum

HardSliding Window
Open on LeetCodeAmazonGoogleMeta

Return the maximum of every contiguous window of size k as it slides across the array.

Constraints
  • 1 <= n <= 10^5
  • 1 <= k <= n
Sheets
Blind 75NeetCode 150NeetCode 250
sliding-window-maximum.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.