标签:++ 区分 scribe pre har auto 字符串长度 tin val
class Solution { public: int FirstNotRepeatingChar(string str) { int len = str.size(); if (len == 0) return -1; map<char, int> mapping; for (auto c : str) mapping[c]++; for (int i = 0; i < len; i++) { if (mapping[str[i]] == 1) return i; } return -1; } };
标签:++ 区分 scribe pre har auto 字符串长度 tin val
原文地址:https://www.cnblogs.com/ruoh3kou/p/10129089.html