Https://ide.codingblocks.com/s/228436


What is wrong??

@Shlok,
https://ide.codingblocks.com/s/228447 corrected code.

I have basically created a Comparator to sort the hashmap by value.

@Shlok,

sorting the elements by values.

In the sample test case we have map as {1=2, 2=1, 3=3}.
After sorting by values will have our hashmap as {2=1, 1=2, 3=3} whose keys will be our answer.

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.