Skip to content

Commit

Permalink
Create 2064.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kapforty authored Nov 14, 2024
1 parent d80d149 commit b590319
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions python3/2064.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution:
def minimizedMaximum(self, n: int, quantities: List[int]) -> int:
def check(amount):
stores = 0
for q in quantities:
stores += ceil(q/amount)
return stores <= n

l, r = 1, max(quantities)
while l < r:
m = (l + r) // 2
if check(m):
r = m
else:
l = m + 1
return l

0 comments on commit b590319

Please sign in to comment.