使用两个数组完成
字符流中第一个不重复的字符
http://www.nowcoder.com/questionTerminal/00de97733b8e4f97a3fb5c680ee10720
byte index = 0;
char[] str = new char[128];
byte[] count = new byte[128];
//Insert one char from stringstream
public void Insert(char ch)
{
str[index++] = ch;
count[ch]++;
}
//return the first appearence once char in current stringstream
public char FirstAppearingOnce()
{
for (int i = 0; i < str.length; i++) {
char c = str[i];
if (count[c] == 1) {
return c;
}
}
return '#';
}