Tap here to switch tabs
Problem
Submissions

Problem: Minimum Removals to Balance Array

Minimum Removals to Balance Array asks you to remove as few values as possible so the remaining array's maximum is no more than k times its minimum.

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

Minimum Removals to Balance Array asks you to remove as few values as possible so the remaining array's maximum is no more than k times its minimum.

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