Solve string and hashmap interview tasks

Quick Overview

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.

Solve string and hashmap interview tasks

Company: Goldman Sachs

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## 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 as `None`/`null`. **Input:** `s` (string) **Output:** the first non-repeating character (or empty marker) **Constraints (typical):** - `1 <= len(s) <= 10^5` - `s` may 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^5` - `score` can be negative or positive (state assumption if you restrict it)

Quick Answer: 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.

|Home/Coding & Algorithms/Goldman Sachs
Goldman Sachs logo
Goldman Sachs
Dec 9, 2025, 12:00 AM
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
18
0

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 as None / null .

Input: s (string)

Output: the first non-repeating character (or empty marker)

Constraints (typical):

  • 1 <= len(s) <= 10^5
  • s may 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^5
  • score can be negative or positive (state assumption if you restrict it)

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...