Given an array of integers and an integer k, return the maximum possible frequency of the most frequent element after at most k increments. Sorting is required because the optimal window grows over ordered values.
nums = array of integers, k = number of increments allowed
maximum achievable frequency
Example 1:
Input:
nums = [1,2,4] k = 5
Output:
3
Explanation:
Increase 1 and 2 to 4 using 5 increments total.
Example 2:
Input:
nums = [1,4,8,13] k = 5
Output:
2
Explanation:
The best you can do is make two elements equal.