int firstUniqChar(char * s){
int i;
int tb[256];
memset(tb,0, sizeof(tb));
for(i=0; s[i]; i++){
tb[s[i]]++;
}
for(i=0; s[i]; i++){
if(tb[s[i]] == 1) return i;
}
return -1;
}
leetcode-387. 字符串中的第一个唯一字符-C语言
最新推荐文章于 2022-11-25 16:24:58 发布