Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
For the best coding experience, use a desktop browser.
Easy
Hash Table
First Unique Character in a String
Return the index of the first non-repeating character in
s
, or -1.
Examples
Input:
s = "leetcode"
Output:
0
Sample Test Cases
Case 1 Input:
"leetcode"
Expected:
0
Case 2 Input:
"loveleetcode"
Expected:
2
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
"leetcode"
Expected:
0
Case 2 Input:
"loveleetcode"
Expected:
2