FastPrepDisk Space Window Analyzer

Disk Space Window Analyzer

Agoda logoAgoda● MediumFULLTIMEPHONE SCREEN
Learn

Problem statement

For every contiguous window of windowSize entries, compute the minimum available space. Return the maximum of those window minimums.

Function

maximizeWindowMinimum(space: int[], windowSize: int) → int

Examples

Example 1

space = [8,2,4,6]windowSize = 2return = 4

Case 1 exercises the documented deterministic contract.

Example 2

space = [1,2,3]windowSize = 1return = 3

Case 2 exercises the documented deterministic contract.

Example 3

space = [5,4,3]windowSize = 3return = 3

Case 3 exercises the documented deterministic contract.

Constraints

  • 1 <= windowSize <= space.length <= 200000.
  • 0 <= space[i] <= 10^9.

More Agoda problems

See Agoda hiring insights
public int maximizeWindowMinimum(int[] space, int windowSize) {
    // Write your code here.
}
space[8,2,4,6]
windowSize2
expected4
Checking account…