Find the Maximum Available Disk Space

Given an array of signed integers of size N, find the maximum integer among all the minima of the subarrays of size K.

Example:

Input:

N = 8

arr = [8, 2, 8, 9, 19, 0, 8, 20]

K = 3

Output:

3

Explanation:

Here we can find total 6 subarrays of size 3 in the original array:[8, 2, 8], [2, 8, 9], [8, 9, 19], [9, 19, 0], [19, 0, 8], [0, 8, 20].

The min value of these subarrays are: 2, 2, 8, 0, 0, 0

The max of the above min values is 8. Return 8.

Hint:

Time Complexity = O(n)

Extra Space Complexity = O(n)


More Amazon Online Assessment Questions 2020 Fall



Get one-to-one training from Google Facebook engineers

Top-notch Professionals

Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.

Customized Private Class

Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.