Description
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.
Examples
Input:
s = "leetcode"Output:
0Explanation:
The first unique character is 'l' at index 0.
Input:
s = "loveleetcode"Output:
2Explanation:
The first unique character is 'v' at index 2.
Input:
s = "aabb"Output:
-1Explanation:
No unique character exists.
Constraints
- •
1 ≤ s.length ≤ 10⁵ - •
s consists of only lowercase English letters.