public class Solution { public int FirstNotRepeatingChar(String str) { if(str == null){ return 0; } int[] count = new int[58]; for(int i =0;i < str.length();i ++){ count[(int)str.charAt(i)-65] += 1; } for(int i =0;i <str.length(); i ++){ if(count[(int)str.charAt(i)-65] == 1){ return i; } } return -1; } }
原文:https://www.cnblogs.com/nlw-blog/p/12439814.html