小写字母
/*
空间换时间
存储26个小写字母所对的数量
遍历数量
*/
class Solution {
public int firstUniqChar(String s) {
int[] arr = new int[26];
for(char c:s.toCharArray())
{
arr[c-'a']++;
}
for(int i=0;i<s.length();i++)
{
if(arr[s.charAt(i)-'a']==1)
return i;
}
return -1;
}
}