标签:none nbsp opened off esc first csdn event ring
ch[str[i]]++;
if(ch[str[i]]==1) return i;
1 class Solution { 2 public: 3 int FirstNotRepeatingChar(string str) { 4 int len = str.length(); 5 if(len==0) 6 return -1; 7 char ch[256] = {0}; 8 for(int i=0;i<len;i++) 9 ch[str[i]]++; 10 for(int i=0;i<len;i++) 11 { 12 if(ch[str[i]]==1) 13 return i; 14 } 15 return -1; 16 } 17 };
https://blog.csdn.net/u013686654/article/details/76125009
标签:none nbsp opened off esc first csdn event ring
原文地址:https://www.cnblogs.com/wxwhnu/p/11421105.html