← 返回 goldmansachs 的题目列表First Unique Character
类型:qbank
Return the first non-repeating character in a string. Recent CoderPad screens use it as the warm-up before Highest Average Score.
Requirements
Input: a string.
Return the first character whose total frequency in the string is exactly one.
If no such character exists, clarify whether to return a sentinel value, index -1, or an empty result.
Notes
Candidates identify this as LeetCode 387. The standard solution is two passes: count characters, then scan for the first count of one.
Follow-up space trade-off: for ASCII / lowercase-only input, use a fixed-size array; for Unicode or arbitrary characters, use a hashmap.
Preparation
Implement both return-character and return-index variants.
Pair it with Highest Average Score in a 30-minute drill, since that is the reported two-question CoderPad set.