|company guide

How to Crack Goldman Sachs Coding Interviews in 2026

Complete guide to Goldman Sachs coding interviews — question patterns, difficulty breakdown, must-practice topics, and preparation strategy.

Goldman Sachs has invested heavily in positioning itself as a technology company that happens to be in finance, and its engineering interview process reflects that shift. The typical loop for a software engineering role includes a recruiter screen, a HackerRank or CoderPad online assessment, one to two technical phone interviews, and a "Super Day" on-site of three to five rounds. The on-site is where the real evaluation happens — each round is 45 to 60 minutes and covers a mix of coding, system design (for senior roles), and behavioral questions. Goldman interviewers are often engineers who work on the firm's internal platforms: the Securities Division's trading systems, the Marcus consumer banking platform, or the GS Financial Cloud.

What distinguishes Goldman from pure tech companies is the expectation that you understand — or at least appreciate — the financial domain. You do not need to be a quant, but demonstrating awareness of how software drives modern finance will resonate with interviewers. Problems sometimes have a financial flavor, involving calculations on datasets, time-series processing, or optimization under constraints that mirror real trading scenarios.

By the Numbers

Goldman Sachs has a focused question bank of 270 questions. The difficulty distribution leans toward medium and hard:

  • Easy: 51 questions (19%)
  • Medium: 171 questions (63%)
  • Hard: 48 questions (18%)

The 63% medium rate is the highest of any company in this guide, meaning the vast majority of what you will face are medium-level problems. The 18% hard rate is moderate — similar to Amazon — and the 19% easy rate means you will occasionally get an approachable warm-up question. Overall, the difficulty profile is manageable if you have strong medium-level skills, but do not neglect hard problems entirely.

Top Topics to Focus On

Arrays — Array manipulation is the most-tested topic at Goldman. Problems involve sorting, searching, aggregation, and transformation of numerical sequences. Given the financial context, these often involve processing numerical data in ways that model real calculations — think profit/loss computations, sliding window averages, or threshold-based filtering. For example, you might be asked to calculate the maximum profit from a time series of stock prices, which is a classic array problem.

def max_profit(prices):
    """
    Calculates the maximum profit from a single buy and sell transaction.
    """
    if not prices:
        return 0
    min_price = float('inf')
    max_profit = 0
    for price in prices:
        if price < min_price:
            min_price = price
        elif price - min_price > max_profit:
            max_profit = price - min_price
    return max_profit

# Example usage
prices = [7, 1, 5, 3, 6, 4]
print(max_profit(prices))  # Output: 5 (buy at 1, sell at 6)

Strings — String problems at Goldman frequently involve parsing and formatting. Processing structured text data, validating formats, and transforming between representations are common. These problems reward careful attention to specification details and edge case handling. A typical problem might involve validating if a given string is a properly formatted financial identifier or converting between different date/time string formats used in transaction logs.

def is_valid_isin(isin_str):
    """
    Basic validation for an International Securities Identification Number (ISIN).
    Format: 2-letter country code, 9-character alphanumeric NSIN, 1 check digit.
    """
    if not isin_str or len(isin_str) != 12:
        return False
    if not isin_str[:2].isalpha():
        return False
    if not isin_str[2:11].isalnum():
        return False
    # In reality, the check digit calculation is more complex (LUHN algorithm)
    if not isin_str[11].isdigit():
        return False
    return True

# Example usage
print(is_valid_isin("US0378331005"))  # Output: True (Apple's ISIN)
print(is_valid_isin("US037833100"))   # Output: False (too short)

Hash Tables — Efficient data retrieval and aggregation using hash maps are fundamental to Goldman's interview problems. Practice grouping, counting, and lookup problems. Goldman also values understanding of performance characteristics — when hash tables degrade and why. A common scenario is finding pairs of transactions that sum to a target value or grouping trades by instrument symbol.

def find_pairs(transactions, target_sum):
    """
    Find all pairs of transaction amounts that sum to a target value.
    Returns list of tuples (amount1, amount2).
    """
    seen = {}
    pairs = []
    for i, amount in enumerate(transactions):
        complement = target_sum - amount
        if complement in seen:
            for idx in seen[complement]:
                pairs.append((complement, amount))
        seen.setdefault(amount, []).append(i)
    return pairs

# Example usage
txns = [100, 200, 300, 100, 400, 50, 150]
target = 250
print(find_pairs(txns, target))
# Output: [(100, 150), (200, 50), (100, 150)]

Dynamic Programming — DP appears at Goldman at a moderate frequency, typically in its more recognizable forms. Sequence problems (longest increasing subsequence, maximum profit), string DP (edit distance), and optimization problems are the most common variants. Goldman DP problems are usually well-specified and reward methodical state definition. A classic problem is calculating the maximum profit with multiple transactions (buying and selling stocks with constraints).

def max_profit_multiple(prices):
    """
    Maximum profit with multiple transactions (buy and sell multiple times).
    You may complete as many transactions as you like.
    """
    if not prices:
        return 0
    profit = 0
    for i in range(1, len(prices)):
        if prices[i] > prices[i - 1]:
            profit += prices[i] - prices[i - 1]
    return profit

# Example usage
prices = [7, 1, 5, 3, 6, 4]
print(max_profit_multiple(prices))  # Output: 7 (Buy 1, sell 5; buy 3, sell 6)

Math — Given Goldman's domain, math shows up more meaningfully than at most pure tech companies. Expect problems involving arithmetic precision, statistical calculations, probability, and optimization. Some problems may require understanding of financial concepts at a basic level — compound interest, rate calculations, or portfolio optimization variants. For instance, you might need to calculate the future value of an investment with compound interest.

def future_value(principal, annual_rate, years, compounds_per_year):
    """
    Calculate future value with compound interest.
    FV = P * (1 + r/n)^(n*t)
    """
    rate_per_period = annual_rate / compounds_per_year
    periods = compounds_per_year * years
    return principal * ((1 + rate_per_period) ** periods)

# Example usage: $1000 at 5% APR, compounded monthly for 10 years
fv = future_value(1000, 0.05, 10, 12)
print(f"${fv:.2f}")  # Output: $1647.01

Preparation Strategy

Weeks 1-2: Core Algorithms and Data Structures. Start with arrays, strings, hash tables, and sorting. Solve 6-8 problems per day at medium difficulty. Goldman interviews value correctness and clean code over raw speed, so focus on getting problems right the first time. After each solution, review it for bugs and consider how you would explain your approach to someone else. Implement fundamental sorting algorithms to understand their trade-offs, as sorting is often a component of array problems.

# Example: QuickSort implementation for practice
def quicksort(arr):
    if len(arr) <= 1:
        return arr
    pivot = arr[len(arr) // 2]
    left = [x for x in arr if x < pivot]
    middle = [x for x in arr if x == pivot]
    right = [x for x in arr if x > pivot]
    return quicksort(left) + middle + quicksort(right)

# Example usage
arr = [3, 6, 8, 10, 1, 2, 1]
print(quicksort(arr))  # Output: [1, 1, 2, 3, 6, 8, 10]

Week 3: Trees, Graphs, and Advanced Data Structures. Cover binary trees (traversals, BST operations, path problems), basic graph algorithms (BFS, DFS, connected components), and useful data structures like heaps and tries. Goldman does not test these as heavily as pure tech companies, but they appear often enough that you cannot afford to skip them. Solve 20-25 problems this week. Practice implementing a binary search tree with insertion and search operations.

class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right

class BST:
    def __init__(self):
        self.root = None

    def insert(self, val):
        if not self.root:
            self.root = TreeNode(val)
            return
        self._insert_recursive(self.root, val)

    def _insert_recursive(self, node, val):
        if val < node.val:
            if node.left:
                self._insert_recursive(node.left, val)
            else:
                node.left = TreeNode(val)
        else:
            if node.right:
                self._insert_recursive(node.right, val)
            else:
                node.right = TreeNode(val)

    def search(self, val):
        return self._search_recursive(self.root, val)

    def _search_recursive(self, node, val):
        if not node:
            return False
        if node.val == val:
            return True
        elif val < node.val:
            return self._search_recursive(node.left, val)
        else:
            return self._search_recursive(node.right, val)

# Example usage
bst = BST()
for num in [5, 3, 7, 1, 4, 6, 8]:
    bst.insert(num)
print(bst.search(4))  # True
print(bst.search(9))  # False

Week 4: Dynamic Programming and Math. Spend equal time on DP and math this week. For DP, cover the standard patterns and practice at least 15 problems. For math, focus on problems involving numerical precision, modular arithmetic, and number properties. Also practice problems that combine math with other techniques — for example, using math insights to optimize a DP solution. A good exercise is implementing the Fibonacci sequence using both memoization (DP) and matrix exponentiation (math optimization).

# Fibonacci with DP memoization
def fib_memo(n, memo={}):
    if n in memo:
        return memo[n]
    if n <= 1:
        return n
    memo[n] = fib_memo(n-1, memo) + fib_memo(n-2, memo)
    return memo[n]

# Fibonacci with matrix exponentiation (O(log n))
def fib_matrix(n):
    if n == 0:
        return 0
    def multiply(a, b):
        return [
            [a[0][0]*b[0][0] + a[0][1]*b[1][0], a[0][0]*b[0][1] + a[0][1]*b[1][1]],
            [a[1][0]*b[0][0] + a[1][1]*b[1][0], a[1][0]*b[0][1] + a[1][1]*b[1][1]]
        ]
    def power(mat, exp):
        result = [[1, 0], [0, 1]]
        base = mat
        while exp > 0:
            if exp % 2 == 1:
                result = multiply(result, base)
            base = multiply(base, base)
            exp //= 2
        return result
    base_matrix = [[1, 1], [1, 0]]
    result_matrix = power(base_matrix, n-1)
    return result_matrix[0][0]

# Compare results
print(fib_memo(10))    # 55
print(fib_matrix(10))  # 55

Week 5: System Design and Domain Knowledge. Goldman interviews for mid-level and senior roles include system design. Prepare for finance-relevant systems: a real-time market data feed, an order management system, a risk calculation pipeline, or a transaction processing system. Even if you are junior, understanding these concepts demonstrates domain awareness. Also review basic concurrency and threading concepts — Goldman's systems are heavily concurrent. Practice implementing a thread-safe data structure like a concurrent hash map or a blocking queue.

import threading
import time
from collections import defaultdict
from queue import Queue

# Simple thread-safe counter for tracking trades
class TradeCounter:
    def __init__(self):
        self._lock = threading.Lock()
        self._counts = defaultdict(int)

    def increment(self, symbol):
        with self._lock:
            self._counts[symbol] += 1

    def get_count(self, symbol):
        with self._lock:
            return self._counts[symbol]

    def get_all_counts(self):
        with self._lock:
            return dict(self._counts)

# Example usage simulating concurrent trade processing
def process_trades(counter, symbol, num_trades):
    for _ in range(num_trades):
        counter.increment(symbol)
        time.sleep(0.001)  # Simulate work

counter = TradeCounter()
threads = []
symbols = ['AAPL', 'GOOGL', 'MSFT']
for symbol in symbols:
    t = threading.Thread(target=process_trades, args=(counter, symbol, 100))
    threads.append(t)
    t.start()

for t in threads:
    t.join()

print(counter.get_all_counts())  # Should show 100 for each symbol

Week 6: Online Assessment Practice and Mock Interviews. Goldman often uses a HackerRank assessment as a gate before the on-site. Practice timed coding assessments: two to three problems in 60-90 minutes. Then run 3-4 full mock interviews covering coding, behavioral, and system design. For behavioral prep, Goldman places heavy emphasis on teamwork, integrity, and how you handle pressure — prepare specific stories that demonstrate these qualities. Practice solving a typical OA problem: finding the maximum subarray sum (Kadane's Algorithm).

def max_subarray_sum(arr):
    """
    Kadane's Algorithm: Find the maximum sum of a contiguous subarray.
    """
    if not arr:
        return 0
    max_ending_here = max_so_far = arr[0]
    for num in arr[1:]:
        max_ending_here = max(num, max_ending_here + num)
        max_so_far = max(max_so_far, max_ending_here)
    return max_so_far

# Example usage (could represent daily P&L)
daily_pnl = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
print(max_subarray_sum(daily_pnl))  # Output: 6 (subarray [4, -1, 2, 1])

Key Tips

  1. Prepare for the online assessment seriously. Many candidates underestimate Goldman's HackerRank round. It is a hard gate — if you do not perform well, you will not reach the on-site. Practice timed assessments to build speed and accuracy under pressure. Simulate real conditions by solving problems with a 45-minute timer.

  2. Demonstrate financial awareness. You do not need to understand derivatives pricing, but knowing what Goldman does — investment banking, trading, asset management, consumer banking through Marcus — and showing genuine interest sets you apart from candidates who treat it as just another coding interview. Research

Related Articles