write a java program to find first non repeating character in a string java
We will be going through each and every character and we will store each character count in a map.
Once the counting is done for each character then we will traverse the map to find first non repeating character in a string which will be the first character whose count is 1.
We have to choose LinkedHashMap because java LinkedHashMap preserves the order in which elements is inserted. If we are using other maps then the insertion order will not be preserved.
Since we need first non repeating character in order so we made use of LinkedHashMap. There are other solutions as well to find first non repeating character in a string but according to me this solution fits well.
SOURCE CODE LINK
Java interview questions and answers playlist
Data structures tutorial playlist
Trees Data structure playlist
Artificial Intelligence algorithms
Intro song credits :
NCS - Culture Code ft. Alexa Ayaz - Slow Burn
INSTAGRAM LINK :