Tap here to switch tabs
Problem
Submissions

Problem: Minimum K to Reduce Array Within Limit

Try to solve the Minimum K to Reduce Array Within Limit problem.

Statement

You are given an array of positive integers nums.

You need to choose a positive integer k. In one operation, you can decrease any element of nums by k. An element is considered eliminated once its value becomes less than or equal to 00. To eliminate an element nums[i], it requires ⌈\lceil nums[i] /k⌉/ k \rceil operations.

Return the minimum positive integer k such that the total number of operations required to make all elements in nums less than or equal to 00 is at most k2k^2.

Constraints:

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

  • 1≤1 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum K to Reduce Array Within Limit

Try to solve the Minimum K to Reduce Array Within Limit problem.

Statement

You are given an array of positive integers nums.

You need to choose a positive integer k. In one operation, you can decrease any element of nums by k. An element is considered eliminated once its value becomes less than or equal to 00. To eliminate an element nums[i], it requires ⌈\lceil nums[i] /k⌉/ k \rceil operations.

Return the minimum positive integer k such that the total number of operations required to make all elements in nums less than or equal to 00 is at most k2k^2.

Constraints:

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

  • 1≤1 \leq nums[i] ≤105\leq 10^5