PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Goldman Sachs

Find first non-repeating character index

Last updated: Mar 29, 2026

Quick Overview

This composite question evaluates proficiency in string processing and frequency analysis for the first-unique-character task, and in data grouping and numeric aggregation for the highest-average-score task, focusing on use of associative structures and algorithmic reasoning.

  • nan
  • Goldman Sachs
  • Coding & Algorithms
  • Software Engineer

Find first non-repeating character index

Company: Goldman Sachs

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: nan

Interview Round: Technical Screen

You are given two separate coding tasks. ## Task 1: First Unique Character Given a string `s` (lowercase/ASCII letters), return the **index of the first character that appears exactly once** in the string. If no such character exists, return `-1`. **Input:** `s` (string) **Output:** integer index (0-based) or `-1` **Examples** - `s = "leetcode"` → `0` (character `'l'`) - `s = "loveleetcode"` → `2` (character `'v'`) - `s = "aabb"` → `-1` --- ## Task 2: Highest Average Score You are given a list of student score records. Each record contains a `student_id` (string) and a `score` (integer). A student can appear multiple times. Compute the **average score per student** (mean of all that student’s scores), and return the **maximum average** across all students. **Input:** list of pairs `[(student_id, score), ...]` **Output:** the highest average (as a floating-point value or as an exact rational; specify your choice during the interview) **Example** Input: `[("a", 80), ("b", 90), ("a", 100)]` - avg(a) = (80 + 100) / 2 = 90 - avg(b) = 90 Output: `90` **Notes / Clarifications to ask:** - Should ties return just the value, or also the student id(s)? - How should rounding be handled if the average is not an integer?

Quick Answer: This composite question evaluates proficiency in string processing and frequency analysis for the first-unique-character task, and in data grouping and numeric aggregation for the highest-average-score task, focusing on use of associative structures and algorithmic reasoning.

Related Interview Questions

  • Implement an Integer Hash Map - Goldman Sachs
  • Solve string and hashmap coding tasks - Goldman Sachs (medium)
  • Solve string and hashmap interview tasks - Goldman Sachs (medium)
  • Count segments and optimize 3-server assignment - Goldman Sachs (medium)
  • Complete decision tree and gradient descent functions - Goldman Sachs (hard)
Goldman Sachs logo
Goldman Sachs
Dec 15, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0

You are given two separate coding tasks.

Task 1: First Unique Character

Given a string s (lowercase/ASCII letters), return the index of the first character that appears exactly once in the string. If no such character exists, return -1.

Input: s (string)

Output: integer index (0-based) or -1

Examples

  • s = "leetcode" → 0 (character 'l' )
  • s = "loveleetcode" → 2 (character 'v' )
  • s = "aabb" → -1

Task 2: Highest Average Score

You are given a list of student score records. Each record contains a student_id (string) and a score (integer). A student can appear multiple times.

Compute the average score per student (mean of all that student’s scores), and return the maximum average across all students.

Input: list of pairs [(student_id, score), ...]

Output: the highest average (as a floating-point value or as an exact rational; specify your choice during the interview)

Example Input: [("a", 80), ("b", 90), ("a", 100)]

  • avg(a) = (80 + 100) / 2 = 90
  • avg(b) = 90 Output: 90

Notes / Clarifications to ask:

  • Should ties return just the value, or also the student id(s)?
  • How should rounding be handled if the average is not an integer?

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Goldman Sachs•More Software Engineer•Goldman Sachs Software Engineer•Goldman Sachs Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.