Each entry of nums is the number of balls in one bag. In one operation, split one bag into two bags, each containing a positive integer number of balls. Newly created bags may be split again.
Using at most maxOperations operations in total, minimize the largest number of balls remaining in any bag. Return that minimum possible largest size.
Example 1:
Input: nums = [7]
maxOperations = 2
Output: 3Explanation: Split 7 into bags of sizes 3 and 4, then split 4 into 2 and 2. The largest bag has size 3. Reaching size 2 would require at least four bags and therefore three splits.
Example 2:
Input: nums = [3,3]
maxOperations = 1
Output: 3Explanation: One split can divide only one of the two size-3 bags. The other remains size 3, so the minimum largest size is 3.
Example 3:
Input: nums = [1,1]
maxOperations = 10
Output: 1Explanation: Every bag already contains one ball. Positive-size bags cannot be split further, and the minimum largest size is 1.
Constraints:
1 <= nums.length <= 1000001 <= nums[i] <= 10000000001 <= maxOperations <= 1000000000