Given a string s, return the index of the first character that appears exactly once. If no such character exists, return -1. The input is a single string, and the output is a single integer index.
Constraints
1 <= len(s) <= 10^5
s consists of lowercase English letters
Function Signature
deffirst_unique_char(s):
Interviewer
Your question is First Unique Character Index. Start with the requirements in the Question tab.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.