Question: Write a function class Solution { public int solution ( int [ ] A ) ; } that, given an array A consisting of N
Write a function
class Solution public int solutionint A;
that, given an array A consisting of N integers, returns the biggest value X which occurs in A exactly X times. If there is no such value, the function should return
Examples:
Given A the function should return The value occurs exactly two times and the value occurs exactly three times, so they both meet the task conditions. The value occurs just once, thus it does not meet the task conditions. The maximum of and is
Given A the function should return The value occurs exactly one time; the value occurs exactly two times.
Given A the function should return There is no value which meets the task conditions.
Given A the function should return
Write an efficient algorithm for the following assumptions:
N is an integer within the range ;
each element of array A is an integer within the range
in c language
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
