Goldman Sachs Interview Questions 2026
Goldman Sachs Interview Questions 2026 (with Answers for Freshers)
Last Updated: March 2026
Introduction
Goldman Sachs is a leading global investment banking, securities, and investment management firm. Founded in 1869 and headquartered in New York, the firm employs over 40,000 people worldwide with major technology hubs in Bangalore, Hyderabad, and Dallas.
Goldman Sachs has transformed into a technology-driven firm, with over 10,000 engineers constituting more than 25% of its workforce. The firm builds and maintains sophisticated trading platforms, risk management systems, data analytics platforms, and consumer banking applications (Marcus).
For freshers, Goldman Sachs offers exceptional opportunities to work on mission-critical systems, learn from top engineering talent, and develop expertise in high-performance computing and financial technology.
Goldman Sachs Selection Process 2026
| Stage | Description | Duration |
|---|---|---|
| Round 1: Online Assessment | Aptitude, Probability, Coding | 120 minutes |
| Round 2: Technical Interview 1 | Algorithms, Data Structures | 45-60 minutes |
| Round 3: Technical Interview 2 | System Design, Problem Solving | 45-60 minutes |
| Round 4: Final Rounds | HM + HR interviews | 60 minutes |
Eligibility Criteria:
- Minimum 7.0 CGPA or equivalent
- Strong programming skills
- Good mathematical aptitude
- CS/IT/ECE/MCA preferred
HR Interview Questions and Answers
1. Tell me about yourself.
2. Why Goldman Sachs?
3. What are your strengths?
4. Describe a challenging problem you solved.
5. Where do you see yourself in 5 years?
Technical Interview Questions and Answers
1. Find the median of two sorted arrays.
def findMedianSortedArrays(nums1, nums2):
if len(nums1) > len(nums2):
nums1, nums2 = nums2, nums1
m, n = len(nums1), len(nums2)
left, right = 0, m
while left <= right:
partitionX = (left + right) // 2
partitionY = (m + n + 1) // 2 - partitionX
maxLeftX = float('-inf') if partitionX == 0 else nums1[partitionX - 1]
minRightX = float('inf') if partitionX == m else nums1[partitionX]
maxLeftY = float('-inf') if partitionY == 0 else nums2[partitionY - 1]
minRightY = float('inf') if partitionY == n else nums2[partitionY]
if maxLeftX <= minRightY and maxLeftY <= minRightX:
if (m + n) % 2 == 0:
return (max(maxLeftX, maxLeftY) + min(minRightX, minRightY)) / 2
else:
return max(maxLeftX, maxLeftY)
elif maxLeftX > minRightY:
right = partitionX - 1
else:
left = partitionX + 1
# Time: O(log(min(m,n)))
# Space: O(1)
2. Design a rate limiter for trading APIs.
import time
from collections import deque
class TokenBucket:
def __init__(self, capacity, refill_rate):
self.capacity = capacity
self.tokens = capacity
self.refill_rate = refill_rate
self.last_refill = time.time()
self.lock = threading.Lock()
def allow_request(self, tokens=1):
with self.lock:
now = time.time()
elapsed = now - self.last_refill
self.tokens = min(self.capacity, self.tokens + elapsed * self.refill_rate)
self.last_refill = now
if self.tokens >= tokens:
self.tokens -= tokens
return True
return False
class RateLimiter:
def __init__(self):
self.buckets = {}
def is_allowed(self, client_id, max_requests=100, window=60):
if client_id not in self.buckets:
self.buckets[client_id] = TokenBucket(max_requests, max_requests/window)
return self.buckets[client_id].allow_request()
3. Find the maximum profit from stock trading (with cooldown).
def maxProfit(prices):
if not prices:
return 0
n = len(prices)
hold = [0] * n # Max profit on day i with stock in hand
sold = [0] * n # Max profit on day i just sold
rest = [0] * n # Max profit on day i resting
hold[0] = -prices[0]
sold[0] = 0
rest[0] = 0
for i in range(1, n):
hold[i] = max(hold[i-1], rest[i-1] - prices[i])
sold[i] = hold[i-1] + prices[i]
rest[i] = max(rest[i-1], sold[i-1])
return max(sold[n-1], rest[n-1])
# Optimized space
def maxProfitOptimized(prices):
if not prices:
return 0
hold, sold, rest = -prices[0], 0, 0
for price in prices[1:]:
prev_sold = sold
sold = hold + price
hold = max(hold, rest - price)
rest = max(rest, prev_sold)
return max(sold, rest)
4. Implement a thread-safe LRU cache.
import java.util.concurrent.*;
import java.util.concurrent.locks.*;
public class ConcurrentLRUCache<K, V> {
private final int capacity;
private final ConcurrentHashMap<K, Node> map;
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private Node head, tail;
private class Node {
K key;
V value;
Node prev, next;
Node(K key, V value) {
this.key = key;
this.value = value;
}
}
public ConcurrentLRUCache(int capacity) {
this.capacity = capacity;
this.map = new ConcurrentHashMap<>();
}
public V get(K key) {
lock.readLock().lock();
try {
Node node = map.get(key);
if (node == null) return null;
lock.readLock().unlock();
lock.writeLock().lock();
try {
moveToHead(node);
return node.value;
} finally {
lock.readLock().lock();
lock.writeLock().unlock();
}
} finally {
lock.readLock().unlock();
}
}
public void put(K key, V value) {
lock.writeLock().lock();
try {
Node node = map.get(key);
if (node != null) {
node.value = value;
moveToHead(node);
} else {
Node newNode = new Node(key, value);
map.put(key, newNode);
addToHead(newNode);
if (map.size() > capacity) {
Node tail = removeTail();
map.remove(tail.key);
}
}
} finally {
lock.writeLock().unlock();
}
}
private void addToHead(Node node) {
// Implementation
}
private void moveToHead(Node node) {
// Implementation
}
private Node removeTail() {
// Implementation
return tail;
}
}
5. Probability: Coin toss game.
Solution:
def probability_3_heads():
"""
Let P(i,j) = probability of winning when we need i more heads and j more tails
P(i,j) = 0.5 * P(i-1, j) + 0.5 * P(i, j-1)
Base cases:
P(0, j) = 1 (got 3 heads, won)
P(i, 0) = 0 (got 3 tails, lost)
"""
memo = {}
def dp(heads_needed, tails_needed):
if heads_needed == 0:
return 1.0
if tails_needed == 0:
return 0.0
if (heads_needed, tails_needed) in memo:
return memo[(heads_needed, tails_needed)]
# 0.5 chance of head + 0.5 chance of tail
result = 0.5 * dp(heads_needed - 1, tails_needed) + \
0.5 * dp(heads_needed, tails_needed - 1)
memo[(heads_needed, tails_needed)] = result
return result
return dp(3, 3)
print(f"Probability: {probability_3_heads():.4f}") # 0.5
Explanation: By symmetry, P(3,3) = 0.5 because the game is fair and the condition is symmetric.
6. Design a distributed transaction system.
- Two-Phase Commit (2PC): Coordinator sends prepare, participants vote, coordinator decides commit/abort
- Saga Pattern: Sequence of local transactions with compensating transactions
- Event Sourcing: Store events rather than state
- CQRS: Separate read and write models
2PC Process:
1. Coordinator sends PREPARE to all participants
2. Participants vote YES/NO and lock resources
3. If all YES, coordinator sends COMMIT
4. If any NO, coordinator sends ROLLBACK
5. Participants execute and release locks
7. Find the kth largest element in an array.
import heapq
def findKthLargest(nums, k):
# Min heap approach - O(n log k)
heap = []
for num in nums:
heapq.heappush(heap, num)
if len(heap) > k:
heapq.heappop(heap)
return heap[0]
def findKthLargestQuickSelect(nums, k):
# Quickselect - O(n) average
def partition(left, right, pivot_idx):
pivot = nums[pivot_idx]
nums[pivot_idx], nums[right] = nums[right], nums[pivot_idx]
store_idx = left
for i in range(left, right):
if nums[i] < pivot:
nums[store_idx], nums[i] = nums[i], nums[store_idx]
store_idx += 1
nums[right], nums[store_idx] = nums[store_idx], nums[right]
return store_idx
def select(left, right, k_smallest):
if left == right:
return nums[left]
pivot_idx = random.randint(left, right)
pivot_idx = partition(left, right, pivot_idx)
if k_smallest == pivot_idx:
return nums[k_smallest]
elif k_smallest < pivot_idx:
return select(left, pivot_idx - 1, k_smallest)
else:
return select(pivot_idx + 1, right, k_smallest)
return select(0, len(nums) - 1, len(nums) - k)
8. Implement an order book for trading.
from sortedcontainers import SortedDict
from collections import deque
from dataclasses import dataclass
from enum import Enum
class Side(Enum):
BUY = 1
SELL = 2
@dataclass
class Order:
order_id: str
side: Side
price: float
quantity: int
timestamp: float
class OrderBook:
def __init__(self):
# Price -> List of orders
self.bids = SortedDict(lambda x: -x) # Descending
self.asks = SortedDict() # Ascending
self.orders = {} # order_id -> Order
def add_order(self, order: Order):
self.orders[order.order_id] = order
book = self.bids if order.side == Side.BUY else self.asks
if order.price not in book:
book[order.price] = deque()
book[order.price].append(order)
self.match_orders()
def match_orders(self):
while self.bids and self.asks:
best_bid_price = next(iter(self.bids))
best_ask_price = next(iter(self.asks))
if best_bid_price >= best_ask_price:
# Match orders
bid_order = self.bids[best_bid_price][0]
ask_order = self.asks[best_ask_price][0]
match_qty = min(bid_order.quantity, ask_order.quantity)
print(f"Match: {match_qty} @ {ask_order.price}")
bid_order.quantity -= match_qty
ask_order.quantity -= match_qty
if bid_order.quantity == 0:
self.bids[best_bid_price].popleft()
if not self.bids[best_bid_price]:
del self.bids[best_bid_price]
if ask_order.quantity == 0:
self.asks[best_ask_price].popleft()
if not self.asks[best_ask_price]:
del self.asks[best_ask_price]
else:
break
def cancel_order(self, order_id: str):
if order_id not in self.orders:
return False
order = self.orders[order_id]
book = self.bids if order.side == Side.BUY else self.asks
if order.price in book:
# Remove from queue
queue = book[order.price]
queue = deque([o for o in queue if o.order_id != order_id])
if queue:
book[order.price] = queue
else:
del book[order.price]
del self.orders[order_id]
return True
def get_best_bid(self):
if not self.bids:
return None
price = next(iter(self.bids))
return price, self.bids[price][0]
def get_best_ask(self):
if not self.asks:
return None
price = next(iter(self.asks))
return price, self.asks[price][0]
9. Explain memory management in C++.
Stack vs Heap:
void example() {
int x; // Stack
int* ptr = new int; // Pointer on stack, int on heap
delete ptr; // Must manually free
}
Smart Pointers:
#include <memory>
// unique_ptr - exclusive ownership
std::unique_ptr<int> up(new int(5));
// shared_ptr - shared ownership with reference counting
std::shared_ptr<int> sp1 = std::make_shared<int>(10);
std::shared_ptr<int> sp2 = sp1; // Ref count = 2
// weak_ptr - non-owning reference to shared object
std::weak_ptr<int> wp = sp1; // Doesn't increase ref count
RAII (Resource Acquisition Is Initialization):
- Resources tied to object lifetime
- Constructor acquires, destructor releases
- Prevents resource leaks
Memory Leak Prevention:
- Use smart pointers instead of raw pointers
- Follow rule of three/five/zero
- Use valgrind/AddressSanitizer for detection
10. Count ways to climb stairs (can climb 1 or 2 steps).
def climbStairs(n):
"""
Dynamic programming solution
dp[i] = number of ways to reach step i
dp[i] = dp[i-1] + dp[i-2]
"""
if n <= 2:
return n
prev2 = 1 # dp[i-2]
prev1 = 2 # dp[i-1]
for i in range(3, n + 1):
current = prev1 + prev2
prev2 = prev1
prev1 = current
return prev1
# Space optimized - O(1) space
def climbStairsOptimized(n):
if n <= 2:
return n
a, b = 1, 2
for _ in range(3, n + 1):
a, b = b, a + b
return b
# Time: O(n), Space: O(1)
Goldman Sachs-Specific Interview Tips
- Master Data Structures & Algorithms: Focus on trees, graphs, heaps, and advanced algorithms
- Practice Competitive Programming: Codeforces, LeetCode hard problems
- Study System Design: Distributed systems, caching, load balancing
- Learn Probability & Statistics: Essential for quant roles
- Understand Low-Latency Programming: Memory layout, cache optimization
- Know Financial Basics: Options, futures, trading concepts
- Prepare for Culture Fit: Show passion for technology and excellence
- Practice Coding on Whiteboard: Clean, efficient code under pressure
- Study C++/Java Deeply: Memory management, concurrency
- Research Goldman Sachs: Know their business divisions and recent initiatives
FAQs
Q: What is the salary for freshers at Goldman Sachs? A: ₹15-25 LPA for software engineering roles in India, depending on role and performance.
Q: How difficult is the interview? A: Very competitive. Focus on hard-level algorithm problems and system design.
Q: What programming languages are preferred? A: Java, C++, Python. C++ is particularly important for low-latency roles.
Q: Is financial knowledge required? A: Not mandatory for SDE roles but helpful. Quant roles require strong math/finance.
Best of luck with your Goldman Sachs interview!
Explore this topic cluster
More resources in Interview Questions
Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.
More in Interview Questions
More from PapersAdda
Goldman Sachs Placement Papers 2026 with Solutions
Top 30 HR Interview Questions with Best Answers (2026)
Top 30 System Design Interview Questions for 2026
Top 40 React.js Interview Questions & Answers (2026)