PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Goldman Sachs

Solve string and hashmap coding tasks

Last updated: Mar 29, 2026

Quick Overview

This multi-part prompt evaluates string manipulation, hash map usage for grouping and lookup, and simulation of sequential commands, along with robustness in handling edge cases and explicit reasoning about time and space complexity.

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

Solve string and hashmap coding tasks

Company: Goldman Sachs

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You will solve the following coding tasks (independent of each other). Provide clear input/output behavior and handle edge cases. ## 1) Longest non-repeating substring (length + substring) Given a string `s`, find: - The **maximum length** of a substring with **no repeated characters**. - **One** such substring achieving that maximum length. Return `(max_len, substring)`. **Clarifications / edge cases to handle:** - `s` can be empty. - If multiple substrings have the same max length, you may return any one (or specify a tie-break rule such as the leftmost). ## 2) Group strings by anagram Given an array of strings `strs`, group the strings into lists where each list contains strings that are anagrams of each other. Return the groups in any order. **Follow-up:** - State and justify the time and space complexity of your approach. ## 3) Execute grid moves from a command string (case-insensitive) You are on an infinite 2D grid starting at `(0, 0)`. You receive a command string `cmd` consisting of characters representing moves: - `U`/`u`: move up `(x, y+1)` - `D`/`d`: move down `(x, y-1)` - `L`/`l`: move left `(x-1, y)` - `R`/`r`: move right `(x+1, y)` Process the string in order and return the final coordinate `(x, y)`. **Clarifications:** - Commands should be treated **case-insensitively** (mixed upper/lower case may appear). - Define what you do with any invalid character (e.g., ignore it or raise an error).

Quick Answer: This multi-part prompt evaluates string manipulation, hash map usage for grouping and lookup, and simulation of sequential commands, along with robustness in handling edge cases and explicit reasoning about time and space complexity.

Related Interview Questions

  • Implement an Integer Hash Map - Goldman Sachs
  • Find first non-repeating character index - Goldman Sachs (nan)
  • 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
Feb 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

You will solve the following coding tasks (independent of each other). Provide clear input/output behavior and handle edge cases.

1) Longest non-repeating substring (length + substring)

Given a string s, find:

  • The maximum length of a substring with no repeated characters .
  • One such substring achieving that maximum length.

Return (max_len, substring).

Clarifications / edge cases to handle:

  • s can be empty.
  • If multiple substrings have the same max length, you may return any one (or specify a tie-break rule such as the leftmost).

2) Group strings by anagram

Given an array of strings strs, group the strings into lists where each list contains strings that are anagrams of each other.

Return the groups in any order.

Follow-up:

  • State and justify the time and space complexity of your approach.

3) Execute grid moves from a command string (case-insensitive)

You are on an infinite 2D grid starting at (0, 0). You receive a command string cmd consisting of characters representing moves:

  • U / u : move up (x, y+1)
  • D / d : move down (x, y-1)
  • L / l : move left (x-1, y)
  • R / r : move right (x+1, y)

Process the string in order and return the final coordinate (x, y).

Clarifications:

  • Commands should be treated case-insensitively (mixed upper/lower case may appear).
  • Define what you do with any invalid character (e.g., ignore it or raise an error).

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.