I dont get the logic

in video the sound is low how we reach to the solution
thought process behind it

hello @mohitsingh

u can use volume booster (a chrome extension) to increase the volume.

it is an observation based problem where u need to observe the working of the given function and implement it in better optimised way.
this is what the given algorithm is doing ->
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.

i dont understand what do you mean assign the values incrementally what we are getting from it

by incrementally i mean one by one , the element whose last occurence is least among all available will come first and then repeat the same on remaining element .

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.