We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98d18de commit f607b2aCopy full SHA for f607b2a
python/minimize_maximum_of_array.py
@@ -0,0 +1,12 @@
1
+# https://leetcode.com/problems/minimize-maximum-of-array/description/
2
+# T:O(n) where n is the number of elements in the array
3
+# S:O(1)
4
+
5
+class Solution:
6
+ def minimizeArrayValue(self, nums: List[int]) -> int:
7
+ minimumValue = 0
8
+ prefixSum = 0
9
+ for i, num in enumerate(nums):
10
+ prefixSum += num
11
+ minimumValue = max(minimumValue,((prefixSum+i)//(i+1)))
12
+ return minimumValue
0 commit comments