Solve string and hashmap interview tasks
Goldman SachsSoftware Engineer · Technical ScreenLast updated
This question evaluates proficiency in string manipulation and hash-based aggregation, specifically skills such as frequency counting, map/dictionary usage, and numeric aggregation for averages.
Coding questions (solve both)
1) First non-repeating character
Given a string s, return the first character that appears exactly once in the string.
- If no such character exists, return an empty value (e.g.,
"") or a special marker such asNone/null.
Input: s (string)
Output: the first non-repeating character (or empty marker)
Constraints (typical):
1 <= len(s) <= 10^5smay contain letters (assume ASCII unless stated otherwise)
2) Best average score
You are given a list of score records. Each record contains a name (string) and a score (integer).
Return the highest average score among all names.
- A person may appear multiple times; their average is the mean of their scores.
- You may assume each person has at least one score.
- Specify how you handle rounding (e.g., return a floating-point number, or return an exact rational/decimal).
Input: records = [(name1, score1), (name2, score2), ...]
Output: the maximum average across names
Constraints (typical):
1 <= len(records) <= 10^5scorecan be negative or positive (state assumption if you restrict it)
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.