Skip to content

Commit b590319

Browse files
authored
Create 2064.py
1 parent d80d149 commit b590319

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

python3/2064.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution:
2+
def minimizedMaximum(self, n: int, quantities: List[int]) -> int:
3+
def check(amount):
4+
stores = 0
5+
for q in quantities:
6+
stores += ceil(q/amount)
7+
return stores <= n
8+
9+
l, r = 1, max(quantities)
10+
while l < r:
11+
m = (l + r) // 2
12+
if check(m):
13+
r = m
14+
else:
15+
l = m + 1
16+
return l

0 commit comments

Comments
 (0)