Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Maximize Frequency Score

Try to solve the Apply Operations to Maximize Frequency Score problem.

Statement

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

In a single operation, you can select any index i and either increase or decrease nums[i] by 11.

The frequency score of the array is defined as the maximum frequency of any value present in nums.

Return the maximum possible frequency score of nums after applying at most k operations.

Constraints:

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

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

  • 0≤0 \leq k ≤1014\leq 10^{14}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Maximize Frequency Score

Try to solve the Apply Operations to Maximize Frequency Score problem.

Statement

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

In a single operation, you can select any index i and either increase or decrease nums[i] by 11.

The frequency score of the array is defined as the maximum frequency of any value present in nums.

Return the maximum possible frequency score of nums after applying at most k operations.

Constraints:

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

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

  • 0≤0 \leq k ≤1014\leq 10^{14}