Sign In
You are coding as a Guest. Sign in with your RoleNest account to permanently track your streak, earn XP, and climb the Campus Leaderboard!
Sign In with RoleNest
🔥Sliding Window Maximum: Monotonic DequeHard
SUPER HARD PROBLEM OF THE DAY+150 XP • FAANG OA TIER

High-difficulty challenge matching authentic Google, Amazon & Uber L5 online assessment conditions.

HardSliding Window•Acceptance: 46.5%

Sliding Window Maximum: Monotonic Deque

Targeted in FAANG & Tech OA:GoogleAmazonSwiggy
Real-World Engineering Context
Used in High-Frequency Trading order book volatility monitors and streaming audio/video loudness peak meters at Spotify and Amazon.
You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window array.

Sample Test Cases

Input: [[1,3,-1,-3,5,3,6,7],3]
Expected: [3,3,5,5,6,7]
Input: [[1],1]
Expected: [1]
Input: [[9,8,7,6,5],3]
Expected: [9,8,7]

Constraints

  • 1 <= nums.length <= 10^5
  • -10^4 <= nums[i] <= 10^4
  • 1 <= k <= nums.length
Recruiter Fast-Track ReferralVerified Candidate
Direct pipeline to Google, Amazon, Microsoft, Swiggy, & Uber recruiters
DevScore: 750/1000

Top DevScore profiles bypass resume screening filters. Every verified problem solve writes authentic proof-of-work to your profile and dispatches you directly into employer inboxes on RoleNest.