v82351be
Search for a command to run...
Given a string s, find the index of the first non-repeating character.
s
Return the index of that character. If every character appears more than once, return -1.
-1
s = "leetcode"
0
'l' appears only once in the string and is the first unique character.
'l'
s = "loveleetcode"
2
'v' is the first character that appears exactly once.
'v'
Every character appears more than once, so there is no unique character.
1 <= s.length <= 10^5
s contains only lowercase English letters
Example 1
aabbccdde
8
Example 2
hyrecruitai
Example 3
mississippi