class Solution {
public int firstUniqChar(String s) {
if(s == null || s.length() == 0)
return -1;
int[] c= new int[26];
for(int i=0; i<s.length(); i++)
c[s.charAt(i) - 'a']++;
for(int i=0; i<s.length(); i++){
if(c[s.charAt(i) - 'a'] == 1)
return i;
}
return -1;
}
}
11-10
864
07-19
724
04-05
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交