Why this is not giving the correct output?
Why this is not giving correct output?
@cbcao263
you had to do.
for(auto it2=m.begin();it2!=m.end();it2++)
{
if(maxsecond)
{
max = it2->second;
a=it2->first;
}
}
i have fixed the code.
and also mp[i] by default is zero. so you could simple do mp[no]++ ,rather than first finding it.
Sir I don’t understand the issue in my code, Please tell about that What was error in mine and In Your Last line like if the no is not present so will it insert in the map and Will it work same as in mine.
And The code is giving TLE in 2 Cases in Test Case 3 and 4.
Thanks Sir, It worked with the last idea that you gave. 
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.