First non repeating character in a running stream

Can you please xplain the brute force approach of this question?

brute force approach

take input and store in array
for i th character traverse in the array from o to i and check whether that char comes before of not
if comes print -1
else print the character

efficient Approach
make a freqArray of size 26
if a character come in the stream
check if it is present or not
if present then print -1
if not print the char

okay , thanks, . . . .:slight_smile:

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.