Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def smallestDivisor(self, nums: List[int], threshold: int) -> int:
- def check(divisor):
- res = 0
- for num in nums:
- res += math.ceil(num / divisor)
- return res <= threshold
- l = 0
- r = max(nums)
- while r - l > 1:
- g = l + (r - l) // 2
- if check(g):
- r = g
- else:
- l = g
- return r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement