what should be inside for loop, i am not able to understand it.
Code not working, has doubt inside for loop
Check this.
it is working fine now but can you please tell why count[str[i]]++ ? i am not getting the logic behind that
count[str[i]]++
means for character at str[i] its frequency is incremented by 1. The array will expect its index to be an integer but you may think that str[i] is a character. Yes str[i] is a character but in count[str[i]]++ compiler will treat str[i] with its ascii value which is an integer(which ranges from 0-255).
So if str[i]==βaβ. Knowing that acii value of βaβ is 97.
count[str[i]]++ will actually be count[97]++
Itβs clear now, Thanks