how to return the value with max frequency
How to give the value
i am not able to understand your doubt
please explain your doubt
and if code is require then also send it
we are storing hasmap of<value,frequency> how to return the value where frequency is maximum
this code is giving wrong answer and run error on cases
but i thinnk it is working
where is it giving wrong ans
also send the question link
https://online.codingblocks.com/app/player/140960/content/150317/5001/code-challenge
the problem is same of the video doubt
test case 0 is right
test case 1 run error and all other wrong answer
n is large and also there is no need to make array
instead of array make map directly
see the code below
modified code
but this code will give TLE because of find() function
as it work in O(n) time
so don’t use this function
initially when you do m[x] by default its value is 0
so you can write m[x]+=1 without any condition
see the code below it is passing all testcases
Correct Code
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.