Smallest Divisor to Satisfy Threshold Problem
Smallest Divisor to Satisfy Threshold Problem — ExecCode Easy DSA Practice
Solve the Smallest Divisor to Satisfy Threshold problem on ExecCode. Free online easy DSA practice in Data Structures and Algorithms. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given:. Your task is to your job is to find the smallest divisor that keeps the total unit count within the allowed threshold. Imagine a backend service that breaks large jobs into billing units. Each job has a size from the array nums. If the service chooses a divisor d, then a job of size x consumes ceil(x / d) units. The operations team has a strict daily unit limit called threshold. Return the required answer exactly as shown in the examples.
Examples
Input {"nums": [1, 2, 5, 9], "threshold": 6}; Output 5. Input {"nums": [44, 22, 33, 11, 1], "threshold": 5}; Output 44. Input {"nums": [2, 3, 5, 7, 11], "threshold": 11}; Output 3
Constraints
1 <= nums.length <= 5 * 10^4 1 <= nums[i] <= 10^6 nums.length <= threshold <= 10^6
Practice Smallest Divisor to Satisfy Threshold free on ExecCode. Browse DSA problems, topic map, and placement guides.