O(n) for time and const space.

```
int firstUniqChar(char* s) {
unsigned int bucket[255]={0};
int i = 0;
for(i=0;i<strlen(s);i++){
bucket[s[i]]++;
}
for(i=0;i<strlen(s);i++){
if(bucket[s[i]]==1){
return i;
}
}
return -1;
}
```