Medium
,Array
,Binary Search
,Greedy
,DP
,Prefix Sum
2439. Minimize Maximum of Array
You are given a 0-indexed array nums
comprising of n
non-negative integers.
In one operation, you must:
i
such that 1 <= i < n
and nums[i] > 0
.nums[i]
by 1.nums[i - 1]
by 1.Return the minimum possible value of the maximum integer of nums
after performing any number of operations.
Example 1:
Example 2:
Constraints:
n
== nums.length
n
<= 105nums[i]
<= 109Yen-Chi ChenWed, Apr 5, 2023
Yen-Chi ChenWed, Apr 5, 2023
binary search版本
MarsgoatApr 11, 2023
跟吉神學習了,真的好神…
MarsgoatApr 11, 2023