题解 | #第一个只出现一次的字符#
第一个只出现一次的字符
https://www.nowcoder.com/practice/1c82e8cf713b4bbeb2a5b31cf5b0417c
class Solution { public: int FirstNotRepeatingChar(string str) { unordered_map<char,int> map; for (auto s : str) map[s]++; for (int i = 0; i < str.size(); i++){ if (map[str[i]] == 1) return i; } return -1; } };