I need some help solving the following competitive programming question. Given array A of size N .now you can make K operations where in each operation you can increase or decrease an element in array by 1. Now beauty of array is frequency of most frequent element in the array. Now output max beauty that can be achieved in K operations. This function takes the following 3 parameters and returns the required answer N- Represents the size of array nums K- Represents the integer K nums- Represents the elements of array nums Input format for custom testing-
The first line contains T, which represents the number of test cases. For each test case- The first line contains N denoting the size of array nums The second line contains integer K. The third line contains N space-separated integers of array A
`Constraints:`1\<T\<10
1\<N\<1e5
0\<K\<1e18
\-1e9\<Ai\<1e9
\`
I tried the following approach , by sorting the array, then finding consecutive differences between them, to get max elements equal in k operations , I need to choose elements from index i to j such that no of operations are min and beauty is maximum.