算法1
(哈希表) $O(n)$
C++ 代码
class Solution {
public:
char firstNotRepeatingChar(string s) {
unordered_map<char, int>map;
for(auto x : s)
{
map[x]++;
}
char res = '#';
for(auto x: s){
if(map[x] == 1)
{ res = x;
return res;}
}
return res;
}
};