Search
⌘K

Leetcode 387. First Unique Character in a String

Return the index of the first character in s that occurs exactly once (or -1 if none). This is typically solved by counting character frequencies then scanning for the first char with count 1 — O(n) time and O(1) extra space for lowercase letters.

Asked at:

Goldman Sachs


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late September, 2025

Goldman Sachs

Mid-level

Comments

Your account is free and you can post anonymously if you choose.