Hash maps and sets · routine
First unique character
Write first_unique(text) returning the index of the first character that appears exactly once, or -1 if there is none.
- right answers
- arguments left as they should be
- fast enough at scale
- without count, Counter, collections
Run adds print(first_unique("leetcode")) after your code, to try it.
Stuck on the idea rather than the code? The Hash maps and sets lesson walks through it.