387 First Unique Character in a String
Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.
Examples:
|
|
思路
非常直白的方法,利用26元素的数组充当一个字典,统计一下字符出现的次数即可。
|
|
Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.
Examples:
|
|
非常直白的方法,利用26元素的数组充当一个字典,统计一下字符出现的次数即可。
|
|