Mike and Hash Trick Problem

Sir, I am not getting what i need to print as output.

Problem Link-https://hack.codingblocks.com/contests/c/668/590

Hi

using the function given you can find the hash value for the array numbers.
In the given test case

has[1]=1, hash[2]=0 and hash[3]=2

now you have to Print k lines, where k is the number of distinct integers in A. ith line contains integer whose hash value is (i-1).

that means you have to print in 1 st line a integer which gives 0 as hash value ( that is 2 )
in 2nd line you have to print integer which has 1 as hash value (i.e 1) in 3rd line you have to print integer which gives 2 as hash value (i.e 3)

Hit like if you get it.
Cheers!

if you need more hints regarding the question refer to this video

1 Like

if your doubt is resolved then pleas mark it as resolved in your online course’s ask doubt section.

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.


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)) time