I’m unable to understand the questions please provide some more example so that i can understand more clearly
Understanding the question
Hello @Pramod123,
We know everytime a number repeats, it is given a new hash value, which is equal to the number of distinct numbers occurred till now. So we can just store the last occurrences of all the numbers and assign the values incrementally, in increasing order of the positions of their last occurrences.
you can also watch this for reference:
Hope, this would help.