All challenges

Algorithm challenge · DSA

Sliding Window Maximum

Difficulty

hard

Time

~40m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#deque#sliding-window
Mission file // read carefullyhard

Given an array nums and a window size k, return an array of the maximum of each contiguous window of size k, left to right.

Example

nums = [1,3,-1,-3,5,3,6,7], k = 3  =>  [3,3,5,5,6,7]

Build with

maxSlidingWindow(nums: int[], k: int) → int[]
PythonJavaScriptTypeScriptGoJavaC++Rust
4 tests · 1 hidden
Auto-graded on submit
Start challenge

Sign in to save your progress.