I did not undertsand how mapping is being done using array.
visited[i]=-1 is being initialized and then later we are writing
last_occ=visited[a[i]] so what value are we exactly storing in last_occ?
also in the else statement what will be value of last_occ?
PLz explain