Regarding maintaining the array

In this where we are storing the last occurrence of the character how can we access the array element with visited[a[i]] where a[i] is a character?

@sukhwinder9813 We are maintaining a map of character with index of last occurrence.
So a[i] is the character and visited array is the map which maps character with index location. visited[a[i]] will store the index of last occurrence of character a[i]. a[i] is a character so its ascii value will be treated in visited[a[i]].

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.