Back to problems

Sliding Window Maximum

Algorithm · Uber · Medium

Requirements Given an integer array nums plus an integer window length k, compute the maximum for each consecutive block containing k elements. Return those maxima in the order the windows are encountered from left to right. The intended approach must outperform independently iterating through every window. Implement the following API: Notes This question was paired with another difficult array task in a coding interview, making efficient use of time important. Be prepared…

Checking your access…