Java – Program to find the first non repeated character in a string


Input – codeforeach , Output – d
Input – principles , Output – r

Pseudo Algorithm

1) Build a map consisting of each character of string with repetition count.
i) Loop through the string characters
ii) For each character,
if the character key is found in the map
increment the value by 1
set the value to 1
2) Loop through the map to find the key ( character ) having value 1. If no key has value 1, return null.




codeforeach : d


Author of . Loves coding and related technologies.