Citadel OA | Disk Space Analysis | Citadel Online Assessment Question
A company is performing an analysis on the computers at its main office. The computers are spaced along a single row.
The analysis is performed in the following way:
- Choose a contiguous segment of a certain number of computers, starting from the beginning of the row.
- Analyze the available hard disk space on each of the computers.
- Determine the minimum available disk space within this segment.
After performing these steps for the first segment, it is then repeated for the next segment, continuing this procedure until the end of the row (for example, if the segment size is 4, computers 1 to 4 would be analyzed, then 2 to 5, etc.) Given this analysis procedure, find the maximum available disk space among all the minima that are found during the analysis.
Relevant Citadel OA Problems:
- Triplets
- Ways to Sum
- Consecutive Sum
- Disk Space Analysis
- Do They Belong?
- Global Maximum
- Initial Public Offering
- Inversions
- Portfolio Balances
- Prime Factor Visitation
- Profit Targets
- Sprint Training
- Throttling Gateway
- Birthday Card Collection
Input
space
: the available hard disk space on each of the computersx
: the segment length to analyze
Output
the maximum of the minimum values available
Examples
Example 1:
Input:
1space = [8,2,4] 2x = 2
Output: 2
Explanation:
In this array of computers, the subarrays of size 2 are [8, 2]
and [2, 4]
. Thus, the initial analysis returns 2 and 2 because those are the minimal for the segments. Finally, the maximum of these values is 2. Therefore, the answer is 2.
Constraints
1<=n<=10^6
1<=x<=n
1<=space[i]<=10^9