Tap here to switch tabs
Problem
Submissions

Problem: Minimum Removals to Balance Array

med
30 min
Try to solve the Minimum Removals to Balance Array problem.

Statement

You are given an integer array nums and an integer k.

An array is considered balanced if the maximum element in the array is less than or equal to the minimum element multiplied by k.

Return the minimum number of elements to remove from nums so that the remaining array becomes balanced.

Constraints:

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

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

  • 1≤1 \leq k ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Removals to Balance Array

med
30 min
Try to solve the Minimum Removals to Balance Array problem.

Statement

You are given an integer array nums and an integer k.

An array is considered balanced if the maximum element in the array is less than or equal to the minimum element multiplied by k.

Return the minimum number of elements to remove from nums so that the remaining array becomes balanced.

Constraints:

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

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

  • 1≤1 \leq k ≤105\leq 10^5