JZ34 第一个只出现一次的字符 本文最后更新于:2022年4月9日 中午 Solution 利用哈希存储 123456789101112131415class Solution {public: int FirstNotRepeatingChar(string str) { if (str.size() == 0) return -1; unordered_map<char, int> umap; for (char c : str) { umap[c]++; } for (int i = 0; i < str.size(); ++i) { if (umap[str[i]] == 1) return i; } return -1; }}; algo 字符串 nowcoder 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! JZ35 数组中的逆序对 上一篇 JZ33 丑数 下一篇 Please enable JavaScript to view the comments powered by Valine.