← 返回 amazon 的题目列表Minimum Sum for Horizontal Scaling
类型:online_judge
amazon
AWS provides a system of servers that are horizontally scaled where computing power is in increasing order after choosing a value x. You must find the minimum x such that the computing power becomes non-decreasing.
Input Format:
int n: number of servers
int[] servers: computing power of each server
Output Format:
int: minimum x making computing power non-decreasing
Constraints:
1 <= n <= 10^5
Example: For the input servers array [4, 1, 6, 2], the output is 5.
Example
Input
4
4 1 6 2