Find the Smallest Divisor Given a Threshold
Medium · Binary Search · about 15 minutes
Asked at Meta, Microsoft, Amazon, Google.
nums holds positive integers. Pick a positive integer d, divide each value by d rounding up, and add up the quotients. Find the smallest d for which that total is no more than threshold. A valid d always exists.