Find the first non-repeating character from a stream characters
We need to understand the question first, then try to find the solution from the words in the sentence.
'first' $\Rightarrow$ Linklist is the good data structure to be thinking.
'non-repeating' $\Rightarrow$ HashMap is something on top of your head.

Use LinkedList to keep track of the first non-repeating character
Use HashMap to identify the repeating character
1. Read the current character from the stream
2. If the character is not in the HashMap, then insert the character to HashMap
3. If the character is in the HashMap, then the character is duplicate.
4. Get the Value from the HashMap, and check whether the value is null or not
5. If the Value is not null, then update the value to be null. Otherwise do nothing.
6. Return the first Node from the LinkedList if the LinkedList has at least one node.
7. Otherwise there is no non-repeating character

0. Given a stream: [a, b, b, ...]
2. Check the HashMap whether it contains 'a'
3. NO, insert 'a' to HashMap and append a Node contains 'a' to the LinkedList
5. Check the HashMap whether it contains 'b'
6. NO, insert 'b' to HashMap and append a Node contains 'b' to the LinkedList
8. Check the HashMap whether it contains 'b'
9. YES, get the reference to the Node contains 'b' in the LinkedList, remove the Node from the LinkedList
10. Update the value to be null with key equals 'b' in HashMap

Note: This is similar question for LRU[Least Recent Used] Cache
Use LinkedList and HashMap, but the Node has to contain key so that Node can be deleted from the HashMap when the Cache is full

static Integer nonRepeatingChar(Integer[] arr, int index){
if(arr != null){
Map<Integer, Node> map = new HashMap<Integer, Node>();

for(int i=0; i<arr.length; i++){
if(i <= index){
Integer ch = arr[i];
if(!map.containsKey(ch)){
Node node = new Node(ch);
map.put(ch, node);
}else{
Node vNode = map.get(ch);
if(vNode != null){
list.remove(vNode);
map.put(ch, null);
}
}
}else{
break;
}
}
}
if(list.size() > 0)
return list.get(0).data;
else
return null;
}