First unique character
Easystringhash mapcounting
Return the index of the first character in s that never repeats, or -1 if there is none.
Example 1
Input: s = "seacode" Output: 0
Example 2
Input: s = "lovelycode" Output: 2
Example 3
Input: s = "aabb" Output: -1
Constraints
- 1 ≤ s.length ≤ 10⁵
- Lowercase English letters
Submit checks your solution against 9 tests, including hidden ones.
/**
* @param {string} s
* @return {int}
*/
function firstUniqChar(s) {
}