โ† All coding problems

First unique character

MediumHashing

Return the index of the first character in s that appears exactly once. Return -1 if there is none.

Function
function solve(s)
Example 1
s = "leetcode"
โ†’ 0

Submit also runs 4 hidden tests, including edge cases.

console.log output is shown below