Challenge Problem

Given an array find the number which comes with maximum frequency. It must work in O(n) time complexity.

Input Format
Enter the size of the array N and add N more numbers and store in an array

Output Format
Display the number with the maximum frequency.

Sample Input
5
1
2
2
2
3
Sample Output
2
here is my solution, it is failing two test cases?

Hi @S15,
ur code is correct. Just make one modification. If 2 numbers are having same frequency output one with smaller value.
eg. input={1,2,2,3,3}, output should be 2 and not 3(test cases are designed this way).
Hope dis resolves ur doubt.

ok thanx it was not written in the question.