The first character that doesn't repeat

A code exercise of about 10 minutes: read the statement, solve «The first character that doesn't repeat» in the browser and get a review like in a real interview.

Code · 10 min
Loading…

Statement

Write firstUniqueChar(s): s only has lowercase letters a to z. Return the index of the first character that appears exactly once in the whole text, or -1 if there's none.