class Solution {
public int firstUniqChar(String s) {
char[] wordsCharArr = s.toCharArray();
int length = s.length();
// int[] flagWords = new int[length];
int index = -1;
for(int i = 0; i < length; i++){
boolean flag = true;
char singleWord = s.charAt(i);
for(int j = 0; j < length; j++){
if(s.charAt(j) == singleWord && j != i){
flag = false;
break;
}
}
if(flag == true){
index = i;
break;
}
}
return index;
}
}
05-14
358
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-27
317
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)