First Unique Character

Easy
Strings String Hash Table

Given a string, find the index of the first non-repeating character. Return -1 if none.

Constraints

1 ≤ s.length ≤ 10^5

Examples

Example 1:
Input: leetcode
Output: 0
Example 2:
Input: loveleetcode
Output: 2
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.