Find first non repeating character in a string

1) Scan the string from left to right and construct the count array. 2) Again, scan the string from left to right and check for count of each character, if you find an element who’s count is 1, return it.

4 Thoughts on “Find first non repeating character in a string”

consider arrayoutofindex case here. rather than puting directly using *(str+i) like this use *(str+i)-offset, here offset might be 65(ascii value if A or 97 ascii value of a) if the string contains only alphabets.