Given a string, find out the first non-repeating character
Interview Question: Given a string, find out the first non-repeating character.
Traverse the string char by char and map each character count to an array(Array size here is 26 since we have 26 english characters).
‘a’ maps to 0 index
‘b’ maps to 1 index
‘c’ maps to 2 index
INPUT STRING: wethecomputerguys
Array Map: [0,0,1,0,3,0,1,1,0,0,0,0,1,0,1,1,0,1,1,2,2,0,1,0,1,0]
Now again traverse the input string and check in the array map. If the count is 1 stop and print the character.