Mike and hashtrick


I should get output as 2 1 3 but getting 2 3 1.
Please resolve .
also resolve TLE.

Try printing elements corresponding wise as provided in the input.
You are sorting the vector which is causing the issue

can you please elaborate?

While printing the values from the hash, take prints in the same order as the input. Do not sort the values unless necessary.
Also it is good idea to use a hashmap in this situation rather than a vector since it provides a key value correspondence, thus each input value’s hash can be retrieved from the map in O(1) time