# 387 First Unique Character in a String (有圖)
應用桶子排序 / 建立桶子 lookup = new Array(26); lookup.fill(0)
Given a string,
find the first non-repeating character in it and return it's index.
If it doesn't exist, return -1.
input: 給一字串
output: 找出第一個沒有重覆的字元Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
Note: You may assume the string contain only lowercase letters.
/**
* @param {string} s
* @return {number}
*/
var firstUniqChar = function(s) {
};如何解
改善


學到什麼
Last updated