Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
Note: You may assume the string contain only lowercase letters.
用数组,简单粗暴,把字符个数都记录下来,最后遍历一下原来的字符串,判断再这个数组里面的个数就行。
public int firstUniqChar1(String s) {
if (s == null || s.length() == 0)
return -