from test Case :
My hash Function is : -1,1,1,1
then how the output will be 2 1 3.Please Explain.
PPlease Explain the given test Case
// 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.