3346. Maximum Frequency of an Element After Performing Operations I
You are given an integer array
numsand two integerskandnumOperations.You must perform an operation
numOperationstimes onnums, where in each operation you:
- Select an index
ithat was not selected in any previous operations.- Add an integer in the range
[-k, k]tonums[i].Return the maximum possible frequency of any element in
numsafter performing the operations.The frequency of an element
xis the number of times it occurs in the array.
1 | class Solution { |