← Back to blog Goldman Sachs OA: Three Question Types Decoded - Circular Toy, Encode/Decode, Maze Min Moves
Goldman Sachs

Goldman Sachs OA: Three Question Types Decoded - Circular Toy, Encode/Decode, Maze Min Moves

2026-06-03

Every summer internship season, the Goldman Sachs Summer Analyst Program is the dream offer for CS / DS / Quant students. It is not only the brand halo - the program offers strong exposure, a high conversion rate, and a way to step outside the usual campus pipeline. But to get that ticket, the first gate is the HackerRank OA, which already filters out a large share of applicants.

This article maps out the GS OA structure: 90 minutes, 2-3 coding problems plus 2 math/logic questions, language-agnostic (Java / Python / C++ / JS all work). The questions cluster around array/string handling, graph-theory variants, and logical reasoning. Below are three realistic problems, broken down one by one.

GS OA Process & Question Type Cheat Sheet

Item Detail
Platform HackerRank (screen recording + microphone monitoring)
Total duration 90 minutes
Number of problems 2-3 coding + 2 math/logic
Languages Java / Python / C++ / JS and other common languages
Question distribution array + string handling, graph-theory variants, logical reasoning

Key point: HackerRank records your screen and microphone, and GS cares whether you can explain your thinking. So even on an OA, narrating your approach is worth practicing - it carries straight into the later VO rounds.

Problem 1: Find the Damaged Toy

At a birthday party, N kids (numbered 1 to N) sit in a circle. The host has T toys and hands them out one at a time, starting from the kid with ID D. After reaching kid N, it wraps back to kid 1. Which kid receives the last (damaged) toy?

Input: N (total kids), T (number of toys), D (starting ID) Output: the ID of the kid who gets the last toy Example: N=5, T=2, D=1 -> output 2 (first toy to Kid 1, second to Kid 2)

This is a Josephus-style circular modulo problem. The key is to turn the "going around the circle" into modular arithmetic rather than simulating each pass.

def find_damaged_toy(N, T, D):
    # Position of the T-th toy: start at D, take T-1 more steps, wrap around.
    # IDs are 1-based; convert to 0-based for the mod, then convert back.
    start = D - 1
    pos = (start + (T - 1)) % N
    return pos + 1

Complexity: O(1). Verbal template: First say "this is circular allocation, essentially (start + steps) mod N," then stress the 1-based / 0-based conversion boundary - that is exactly where the interviewer likes to dig.

Problem 2: Encode / Decode Message

Given a message (string) and a key (positive integer). Based on operation type op:

  • op=1 (encode): repeat each character by the digits of key (used cyclically).
  • op=2 (decode): compress repeated characters back using the digits of key (cyclically). If the repeat counts do not match the key, return -1.

Example: op=1, message="Open", key=123 -> "Oppeen" Example: op=2, message="Oppeen", key=123 -> "Open"

The core idea is to split the key into a digit sequence and align it cyclically to each original character.

def transform(op, message, key):
    digits = [int(c) for c in str(key)]
    if op == 1:  # encode
        out = []
        for i, ch in enumerate(message):
            out.append(ch * digits[i % len(digits)])
        return "".join(out)
    else:  # decode
        out = []
        i = 0          # pointer into message
        k = 0          # pointer into key digits
        while i < len(message):
            cnt = digits[k % len(digits)]
            ch = message[i]
            # check the next cnt characters are all identical
            if message[i:i + cnt] != ch * cnt:
                return -1
            out.append(ch)
            i += cnt
            k += 1
        return "".join(out)

Complexity: encode O(output length), decode O(n). Trap: during decode, if fewer than cnt characters remain, or the repeat count does not match the key, you must return -1 - this is the most common hidden-case edge.

Problem 3: Minimum Moves in a Maze

An n x m maze, 0 = empty, 1 = obstacle. Move from (0,0) to (n-1, m-1). Each move can jump 1 to k steps in one direction, but every jumped-over cell must be 0. Return the minimum number of moves, or -1 if unreachable.

Constraints: 1 <= n, m <= 100, 1 <= k <= 100.

This is a BFS shortest path with jumps: from each cell, try jumping 1 to k steps in each of the four directions, stopping that direction at an obstacle.

from collections import deque

def getMinimumMoves(maze, k):
    n, m = len(maze), len(maze[0])
    if maze[0][0] == 1 or maze[n-1][m-1] == 1:
        return -1
    dist = [[-1] * m for _ in range(n)]
    dist[0][0] = 0
    q = deque([(0, 0)])
    dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]
    while q:
        r, c = q.popleft()
        if (r, c) == (n - 1, m - 1):
            return dist[r][c]
        for dr, dc in dirs:
            # jump 1..k steps in this direction; stop at obstacle or out of bounds
            for step in range(1, k + 1):
                nr, nc = r + dr * step, c + dc * step
                if not (0 <= nr < n and 0 <= nc < m):
                    break
                if maze[nr][nc] == 1:
                    break
                if dist[nr][nc] == -1:
                    dist[nr][nc] = dist[r][c] + 1
                    q.append((nr, nc))
    return dist[n-1][m-1]

Complexity: O(nmk), around 100100100 = 1e6, comfortably under a 4-second limit. Trap: once you hit an obstacle along a jump direction you must break (not continue), because every jumped-over cell has to be empty.

Preparation Advice

FAQ

Q1: Does the GS OA require full AC to pass? No. HackerRank accumulates score by the number of hidden cases passed, but GS sets the bar high, so aim for near-full AC on at least two problems.

Q2: How heavily are math/logic questions weighted? Usually 2 questions with non-trivial weight. They lean toward probability, combinatorics, and simple game theory - budget about 15 minutes for them.

Q3: Can I use Python? Will it cost me on speed? Yes. The data sizes here are small, so Python will not TLE. Where Python hurts is on Quant-track numerical problems - use C++ there.

Q4: How long after the OA does the VO come? Typically 1-2 weeks. The GS VO is a superday format with 4-6 back-to-back rounds, so start preparing as soon as the OA is done.


Preparing for the Goldman Sachs OA?

If you are stuck on "can't parse the English prompt," "no time for the math questions," or want a real person doing OA proxy / VO assist on interview day - platform environment checks plus real-time synchronized support - let's talk through a full OA assist / VO live support plan: from question-type prediction and timed mocks to full real-time support and debrief, covering HackerRank / Codility / CodeSignal / Karat.


Contact

Need real interview questions and a tailored prep plan? Message WeChat Coding0201 now, get the question bank.

Email: [email protected] Telegram: @OAVOProxy