15. Smallest Divisor
โ GFG solution to the Smallest Divisor problem: find the smallest divisor such that sum of ceiling divisions is โค k using binary search. ๐
๐งฉ Problem Description
๐ Examples
Example 1
Input: arr[] = [1, 2, 5, 9], k = 6
Output: 5
Explanation: 5 is the smallest divisor having sum of quotients:
โ1/5โ + โ2/5โ + โ5/5โ + โ9/5โ = 1 + 1 + 1 + 2 = 5 โค 6Example 2
Input: arr[] = [1, 1, 1, 1], k = 4
Output: 1
Explanation: 1 is the smallest divisor having sum of quotients:
โ1/1โ + โ1/1โ + โ1/1โ + โ1/1โ = 1 + 1 + 1 + 1 = 4 โค 4๐ Constraints
โ
My Approach
Binary Search
๐ Time and Auxiliary Space Complexity
๐งโ๐ป Code (C++)
๐งโ๐ป Code (Java)
๐ Code (Python)
๐ง Contribution and Support
๐Visitor Count
Last updated