Sir, Why we are doing freq[s[i]-‘a’] .
What is the significance of ‘a’ here and why are we are subtracting it?
The previously present string can be any character, why specifically we are taking ‘a’ ?
Frequency of unique string
freq is an array so index should be integer
s[i] is character but it store as ascii value which is of the range 97 to 122
but we want that a is mapped to 0 and b with 1 and so on
so we subtract it with ‘a’
suppose str[i]=‘c’
when we do str[i]-‘a’ then it will 3
so it stored at freq[3] which we want
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask