Given an integer array nums and an integer threshold, choose a positive integer divisor d such that the sum of each element in nums divided by d and rounded up is at most threshold.
Find the smallest positive divisor such that the sum of all rounded division results is less than or equal to threshold. Return this smallest divisor.
Note: Each division result is rounded up to the nearest integer greater than or equal to the result (i.e., its ceiling value). For example,
7 / 3is rounded up to3, while10 / 2remains5. After rounding, all the resulting values are summed together.
Constraints:
nums.length
nums[i]
nums.length threshold
Given an integer array nums and an integer threshold, choose a positive integer divisor d such that the sum of each element in nums divided by d and rounded up is at most threshold.
Find the smallest positive divisor such that the sum of all rounded division results is less than or equal to threshold. Return this smallest divisor.
Note: Each division result is rounded up to the nearest integer greater than or equal to the result (i.e., its ceiling value). For example,
7 / 3is rounded up to3, while10 / 2remains5. After rounding, all the resulting values are summed together.
Constraints:
nums.length
nums[i]
nums.length threshold