First Non-Repeating Character in a String
Problem
Return the index of the first character that does not repeat; return -1 if none.
Input / Output
- Input: a string
s. - Output: the index of the first non-repeating character, or -1 if every character repeats.
Constraints
- 1 ≤ s.length ≤ 10^5
Example
"leetcode" -> 0; "aabb" -> -1
added …