Given an array of integers A of size N and an integer B.
In a single operation, any one element of array can be increased by 1. You are allowed to do atmost B such operations.
Find the number with maximum number of occurrences and return an array C of size 2, where C is number of occurence and C is the number with maximum occurence. If there are several such numbers, your task is to find the minimum one.
The first argument given is the integer array A. The second argument given is the integer B.
Return an array C of size 2, where C is number of occurence and C is the number with maximum occurence.
1 <= N <= 10^5 -10^9 <= A[i] <= 10^9 0 <= B <= 10^9
Input 1: A = [3, 1, 2, 2, 1] B = 3 Output 1: C = [4, 2] Explanation: Apply operations on A and A A = [3, 2, 2, 2, 2] Maximum occurence = 4 Minimum value of element with maximum occurence = 2 Input 2: A = [5, 5, 5] B = 3 Output 2: C = [3, 5]
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.