public class Solution {
public int FirstNotRepeatingChar(String str) {
if(str == null || str.length() == 0) {
return -1;
}
int[] counts = new int[128];
char[] arr = str.toCharArray();
for(char ch : arr) {
counts[ch]++;
}
for(int i = 0; i < arr.length; i++) {
if(counts[arr[i]] == 1) {
return i;
}
}
return -1;
}
}