Company Interview Questions · Banking & Fintech
Goldman Sachs & Morgan Stanley: Engineering (ML) Interviews
Goldman Sachs & Morgan Stanley: Engineering Analyst (ML) and Tech Interviews (2025). Rounds, real reported questions and model answers, compiled from public candidate reports (sources at the end). Practice mode hides every answer: say your answer first, press Show answer, then rate yourself. Use 🔁 Review again to build your revision list and 🎲 Random question for a quick drill.
About this interview
Compiled from public candidate reports: Goldman Sachs Engineering Analyst with an ML-focused round (Bengaluru, June 2025, waitlisted) and other Bengaluru reports (2025), plus Morgan Stanley technology intern reports (Bengaluru and Mumbai, 2025) that show the coding bar. The questions are paraphrased, and the model answers are written by EasyLearnSpace.
| Goldman Sachs | Morgan Stanley | |
|---|---|---|
| Role | Engineering Analyst (ML team); Engineering Analyst | Technology / SDE intern; GenAI developer roles listed |
| Rounds | R1: ML + DSA (explain and code parts of your model; HashMap, in-order/post-order traversal, sorting); R2: one coding problem (in-order variant). Others: OA (DP, graphs) → 3 technical/HR rounds | OA (SHL) → technical → HR; or technical → culture fit |
| Reported questions | Retrieve values from a dataset, ML terminology, BST insert, print the tree boundary | Quicksort complexity, linked lists, OS basics, design Uber |
| Outcome | Waitlisted, then not selected; others not selected | Not selected (interns) |
01Rounds at a glance
- The DSA bar is high at both banks. Even ML-team roles include tree and hash-map problems.
- ML round (GS): explain your model and write parts of it live. Know your code.
02Questions and model answers
Q1
Print the boundary (outer layer) of a binary tree anticlockwise.
def boundary(root):
if not root: return []
is_leaf = lambda n: not n.left and not n.right
res = [root.val] if not is_leaf(root) else []
n = root.left # left boundary (top-down, no leaves)
while n:
if not is_leaf(n): res.append(n.val)
n = n.left or n.right
def leaves(n):
if not n: return
if is_leaf(n): res.append(n.val); return
leaves(n.left); leaves(n.right)
leaves(root)
right, n = [], root.right # right boundary (bottom-up, no leaves)
while n:
if not is_leaf(n): right.append(n.val)
n = n.right or n.left
return res + right[::-1]
Q2
Insert a value into a binary search tree.
def insert(root, val):
if not root: return Node(val)
if val < root.val: root.left = insert(root.left, val)
else: root.right = insert(root.right, val)
return root
- O(h) time: O(log n) when balanced, O(n) when skewed. Mention self-balancing trees (AVL, red-black).
Q3
Explain your ML model and write its core training code.
- Framing: "Default prediction with gradient boosting. Features: payment history, utilisation, tenure. Target: 90+ days past due within 12 months."
- Code skeleton:
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
import lightgbm as lgb
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=.2, stratify=y, random_state=0)
m = lgb.LGBMClassifier(n_estimators=500, learning_rate=.05, num_leaves=31, class_weight="balanced")
m.fit(Xtr, ytr, eval_set=[(Xte, yte)], callbacks=[lgb.early_stopping(50)])
print("AUC", roc_auc_score(yte, m.predict_proba(Xte)[:, 1]))
- Be ready to explain every parameter, the validation choice and the feature importance.
Q4
Quicksort: what is its time complexity, and how do you avoid the worst case?
- Average O(n log n), worst case O(n²) when the pivots are consistently the smallest or largest (for example, sorted input with a first-element pivot).
- Avoid it: random pivot, median-of-three, introsort (switch to heapsort at a recursion-depth limit), and three-way partitioning for many duplicates.
- It sorts in place (O(log n) stack) and is not stable.
Q5
High-level design: design a ride-hailing system like Uber.
- Core services:
- Rider and driver apps.
- Location service (drivers send GPS every ~4 s, stored in a geo-index: geohash or quadtree, in Redis).
- Matching service (find nearby available drivers, ranked by ETA).
- Trip service (state machine).
- Pricing (surge = f(demand/supply per zone)).
- Payments.
- Notifications.
- Data: a trips DB (SQL for consistency), location data (in-memory plus a time-series store), Kafka for events.
- Scale: partition by city or region, WebSockets for live updates, idempotent payment APIs.
- ML hooks: ETA prediction, surge forecasting, fraud detection, driver–rider matching optimisation.
Q6
ML terminology quick-fire: precision, recall, AUC, regularisation, cross-validation, feature leakage.
- Precision = TP/(TP+FP). Recall = TP/(TP+FN).
- AUC = the probability that a random positive ranks above a random negative.
- Regularisation penalises complexity (L1/L2) to reduce overfitting.
- Cross-validation rotates validation folds for a robust estimate.
- Leakage means a feature contains information unavailable at prediction time, which inflates offline scores.
- Give one-line definitions plus an example each; quick-fire rounds reward crispness.
03How to prepare
- DSA: trees (traversals, boundary, BST operations), hash maps, DP and graphs at medium level, timed.
- ML: be able to code and explain your own model end to end.
- Design: one classic system design (Uber, BookMyShow) at a high level.
Sources
- Glassdoor: Goldman Sachs Engineering Analyst reviews (Bengaluru 2025)
- Glassdoor: Morgan Stanley technology interview reviews (2025)
Created by Ajeetkumar