Problem
Given a list of positive integers nums and an integer threshold, choose a positive integer divisor d. Divide every number by d, rounding each result up, and add the results. Return the smallest divisor whose total is <= threshold.
Example 1
- Input
- nums = [1, 2, 5, 9], threshold = 6
- Output
- 5
- Why
- 1 + 1 + 1 + 2 = 5
Example 2
- Input
- nums = [44, 22, 33, 11, 1], threshold = 5
- Output
- 44
Example 3
- Input
- nums = [2, 3, 5, 7, 11], threshold = 11
- Output
- 3
Constraints
1 <= nums.length <= 5 * 10^41 <= nums[i] <= 10^6nums.length <= threshold <= 10^6