There is a run error
hello @ashish_arora369

for i =0 ,i-1 will be -1 and in the highlighted part u will try to access -1 index ,which will give u error.
![]()
here it should be ==
also u r overcomplicating this
the idea is simple use hastable/array to store frequency (make it of size 256).
now iterate the string from start to end and increment the count of current charater in ur hashtable.
and then print that character which has maximum count
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.