Can anyone explain me, how is the output 2 1 3 because when i run this code it gives 1 0 2
Doubt in Mike and HashTrick
// You can’t use the given hash function as maximum element can get upto 1e9. And in that hash function loop is running till maximum element so it will lead to TLE. You have to analyze that hash function and implement it in such a way that your function will give the same output as hash function did.
// Example -
// 4
// 1 2 1 3
last index of every distinct element i.e
1 -> 2
2 -> 1
3 -> 3
now sort on the basis of their last index and you will get the answer same what hash function give.
Here is my code , for further understanding.
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.