Find the first non-repeated character in a string.
Respuestas de entrevistas
Anónimo
22 mar 2019
The easiest way is to add characters to a map if not already contained in the map (or set).
Anónimo
22 mar 2019
Oops someone pointed out to me it’s non-repeated.
Easy with a map. Two pass. First pass count the occurrence of characters. Second pass check the counts. Stop on the first character count == 1.