Mike and hash trick


error?

Hello @Vibhuti0206,

There is a syntax error in your code:
it.second
Correction:
it->second

Moreover, the logic you have applied is incorrect.
Please, read the question again.
Try to figure out the functionality of the hash function given,

Refer to the following code if you face any difficulty:

Hope, this would help.
Give a like if you are satisfied.

check out the link…it can easily be solved using 2 maps…In O(n)…
If use sorting then it will take O(nlog(n))…