Find the Smallest Divisor Given a Threshold LeetCode solution in Python
1class Solution:2def helper(self, nums, m):3Sum = 04for n in nums:5Sum += math.ceil(n / m)6return Sum78def smallestDivisor(self, nums: List[int], threshold: int) -> int:9l, r = 1, max(nums)10while l < r:11mid = (l + r) // 212Sum = self.helper(nums, mid)13if Sum > threshold:14l = mid + 115else:16r = mid17return r