Tap here to switch tabs
Problem
Submissions

Problem: Minimum Limit of Balls in a Bag

med
30 min
Try to solve the Minimum Limit of Balls in a Bag problem.

Statement

You are given an integer array nums, where nums[i] is the number of balls in the iith bag. You may perform at most maxOperations operations.

In one operation, choose a bag containing xx balls and split it into two non empty bags containing aa and bb balls such that a+b=xa + b = x.

Define the penalty as the maximum number of balls in any bag after performing at most maxOperations operations. Return the minimum possible penalty.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq maxOperations, nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Limit of Balls in a Bag

med
30 min
Try to solve the Minimum Limit of Balls in a Bag problem.

Statement

You are given an integer array nums, where nums[i] is the number of balls in the iith bag. You may perform at most maxOperations operations.

In one operation, choose a bag containing xx balls and split it into two non empty bags containing aa and bb balls such that a+b=xa + b = x.

Define the penalty as the maximum number of balls in any bag after performing at most maxOperations operations. Return the minimum possible penalty.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq maxOperations, nums[i] ≤109\leq 10^9