Skip to main content

Medium Tier Problems

Reading time: ~55 min | Interview relevance: Critical | Roles: All AI/ML Roles - MLE, AI Engineer, Data Scientist, MLOps, Data Engineer

If you could only prepare at one difficulty level, it should be medium. Medium-tier problems make up 60-70% of all interview questions at major tech companies. They are hard enough to separate prepared candidates from unprepared ones, but not so hard that they become puzzle-solving exercises disconnected from real work.

This list of 45 problems covers every category you will encounter in AI/ML interviews: coding, ML implementation, data processing, system design, and applied ML. Each problem is calibrated to be solvable in 20-35 minutes by a well-prepared candidate. If you can solve all 45 cleanly and quickly, you are ready for the vast majority of interview rounds at any company.

Category Distribution

CategoryCountPercentageDescription
DSA & Coding1533%Core algorithms with ML-relevant applications
ML Implementation818%Algorithm implementation and training concepts
System Design716%End-to-end ML system design
SQL & Data511%ETL, SQL, data manipulation
NumPy/Pandas511%Data processing and analysis
Applied ML & Statistics511%Practical ML decisions and statistical reasoning

:::tip The Medium-Tier Mindset Medium problems test pattern recognition, not genius. For each problem, ask yourself: "What pattern does this match?" If you know 15-20 patterns cold, you can solve any medium problem. The patterns section at the end of this document lists all of them. :::

Category 1: DSA & Coding (15 Problems)

These problems combine standard algorithms with data processing and ML-relevant applications. They form the largest chunk of any coding interview.

Array & String Problems

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
13SumMedium25 minSort + two pointersMulti-pointer technique; duplicate handlingFAANG, AllCoding Interviews
2Group AnagramsMedium20 minHash map with sorted keyCanonical form mapping; grouping by equivalence classGoogle, Amazon, MetaCoding Interviews
3Product of Array Except SelfMedium20 minPrefix/suffix arraysBuilding auxiliary arrays; O(1) extra space variantFAANG, AllCoding Interviews
4Longest Substring Without Repeating CharactersMedium20 minSliding windowWindow expansion/contraction; hash set trackingFAANG, AllCoding Interviews
5Container With Most WaterMedium20 minTwo pointersGreedy pointer movement; area optimizationFAANG, AllCoding Interviews
6Rotate Image (Matrix Rotation)Medium20 minTranspose + reverseIn-place matrix manipulation; layer-by-layer rotationAmazon, Google, MicrosoftCoding Interviews
7Spiral Matrix TraversalMedium25 minBoundary trackingDirection state machine; boundary shrinkingAmazon, Google, BloombergCoding Interviews

Tree & Graph Problems

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
8LRU CacheMedium30 minHash map + doubly-linked listO(1) get/put with eviction; foundational for caching systemsFAANG, AllCoding Interviews
9Number of IslandsMedium20 minBFS/DFS flood fillConnected components; grid traversalFAANG, AllCoding Interviews
10Course Schedule (Topological Sort)Medium25 minDFS cycle detection + topo sortDAG processing; dependency resolution for pipeline orderingGoogle, Meta, AmazonCoding Interviews
11Binary Tree Level Order TraversalMedium20 minBFS with level trackingQueue-based traversal; level-aware processingAllCoding Interviews

Advanced Patterns

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
12Meeting Rooms IIMedium25 minSweep line / min-heapResource scheduling; GPU allocation; training job schedulingGoogle, Meta, UberCoding Interviews
13Coin ChangeMedium25 minBottom-up DPOptimal substructure; tabulation vs. memoizationFAANG, AllCoding Interviews
14Implement a Rate Limiter (Leaky Bucket)Medium25 minQueue-based rate limitingAPI rate limiting for model serving endpointsUber, Airbnb, StripeML System Design
15Top K Frequent ElementsMedium20 minHeap / bucket sortPriority queues; frequency analysis for feature selectionAmazon, Google, MetaCoding Interviews

:::warning DSA Coding Red Flags

  • Jumping to code without discussing approach first
  • Not considering edge cases (empty input, single element, overflow)
  • Writing O(n^2) when O(n) or O(n log n) is expected
  • Cannot analyze time and space complexity of your solution
  • Ignoring the interviewer's hints (they are trying to help) :::

Category 2: ML Implementation (8 Problems)

These problems test whether you understand ML algorithms deeply enough to implement them, not just call sklearn. Interviewers want to see you write the math in code.

Algorithm Implementation

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
16Implement Batch Gradient Descent with Mini-BatchesMedium30 minData batching + gradient accumulationCore training loop; batch vs. stochastic tradeoffsFAANG, AI LabsML Fundamentals
17Implement TF-IDF from ScratchMedium25 minTerm frequency + inverse document frequencyText feature engineering; information retrieval basicsGoogle, AmazonML Fundamentals
18Implement AUC-ROC ComputationMedium25 minSorting + threshold sweepRanking metrics; threshold-independent evaluationMeta, Uber, AirbnbML Fundamentals
19Implement Stratified K-Fold Cross-ValidationMedium25 minBalanced splittingClass balance preservation; evaluation rigorGoogle, MetaML Fundamentals

Training & Evaluation

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
20Implement Decision Tree (ID3/CART) for ClassificationMedium35 minRecursive partitioning + information gainTree building, feature selection, stopping criteriaGoogle, Amazon, Big TechML Fundamentals
21Implement a Streaming Mean and Variance CalculatorMedium20 minWelford's algorithmOnline computation; numerical stabilityGoogle, Uber, DatabricksML Fundamentals
22Implement Reservoir SamplingMedium20 minProbabilistic samplingSampling from streams; uniform probability guaranteeGoogle, MetaML Fundamentals
23Implement Learning Rate Scheduling (Step Decay + Cosine Annealing)Medium25 minSchedule functionsTraining stability and convergence speedGoogle, Meta, AI LabsDeep Learning

:::tip ML Implementation Strategy When implementing ML algorithms in interviews:

  1. Start with the mathematical formulation (write it down)
  2. Identify the core operation (dot product, distance, gradient)
  3. Use NumPy vectorization (never loop over data points)
  4. Handle edge cases (empty data, single class, numerical overflow)
  5. Discuss complexity (training time, inference time, space) :::

Category 3: System Design (7 Problems)

Medium-tier system design problems focus on well-scoped ML systems. You should be able to cover end-to-end architecture in 35-40 minutes.

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
24Design a Product Recommendation System for E-CommerceMedium40 minCollaborative filtering + content-basedThe canonical MLE system design problemAmazon, Meta, PinterestML System Design
25Design a Spam Detection SystemMedium35 minText classification + feedback loopsContent safety with adversarial robustnessGoogle, Meta, MicrosoftML System Design
26Design a Credit Risk Scoring SystemMedium35 minFeature engineering + explainabilityRegulated ML with fairness constraintsStripe, Square, GoldmanML System Design
27Design an Anomaly Detection System for Cloud InfrastructureMedium35 minTime-series models + alertingInfrastructure monitoring with MLGoogle, Amazon, DatadogML System Design
28Design a Model A/B Testing FrameworkMedium35 minTraffic splitting, statistical testsRigorous model deployment and evaluationFAANG, Big TechML System Design
29Design a Feature Pipeline with Online and Offline ServingMedium35 minFeature computation, consistencyFeature store design; online/offline consistencyUber, Airbnb, DatabricksML System Design
30Design a Document Classification PipelineMedium35 minNLP preprocessing + embeddingsEnd-to-end NLP system with servingGoogle, AmazonML System Design

:::note System Design Framework for Medium Problems Use this structure for every medium system design answer:

  1. Clarify requirements (2 min): Users, scale, latency, freshness
  2. High-level architecture (5 min): Draw the boxes and arrows
  3. Data pipeline (8 min): How data flows from raw to features
  4. Model architecture (8 min): Why this model for this problem
  5. Serving (7 min): How predictions reach users
  6. Monitoring (5 min): What can go wrong and how you detect it
  7. Follow-ups (5 min): Scaling, improvements, edge cases :::

Category 4: SQL & Data (5 Problems)

SQL and data manipulation problems that appear in every data-adjacent role. Window functions are the most critical skill.

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
31Find the Nth Highest Salary per DepartmentMedium20 minWindow functions (DENSE_RANK)Ranking within groups; window function fluencyGoogle, Amazon, MetaCoding Interviews
32Compute Retention CohortsMedium25 minSelf-join, date arithmeticProduct analytics; user lifecycle analysisMeta, Spotify, PinterestCoding Interviews
33Sessionize Clickstream DataMedium30 minLAG + cumulative SUMUser behavior analysis; the canonical DE SQL problemGoogle, Meta, AirbnbCoding Interviews
34Write an Idempotent MERGE (Upsert) StatementMedium20 minMERGE / INSERT ON CONFLICTPipeline reruns must not duplicate dataAllCoding Interviews
35Compute a Funnel Analysis Across Multiple StepsMedium25 minCASE WHEN + window functionsProduct analytics; conversion trackingMeta, Airbnb, UberCoding Interviews

Category 5: NumPy/Pandas (5 Problems)

Data processing problems using Python's core data stack. These appear in almost every MLE and DS interview.

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
36Implement a Schema Validator for Incoming JSON DataMedium25 minSchema validation, error handlingData quality at ingestion; defensive programmingAirbnb, StripeCoding Interviews
37Build an Incremental Data Loader with WatermarksMedium30 minChange tracking, watermark logicIncremental processing reduces cost and latencyFAANG, DatabricksCoding Interviews
38Flatten Deeply Nested JSON to Tabular FormatMedium25 minRecursive parsingSemi-structured data handling; schema inferenceAirbnb, SnowflakeCoding Interviews
39Build a Data Deduplication PipelineMedium25 minHashing, window-based dedupExact and near-duplicate detectionMeta, Airbnb, UberCoding Interviews
40Compute Rolling Statistics with GroupByMedium20 minPandas rolling + groupbyTime-series feature engineering; window aggregationAllML Fundamentals

Category 6: Applied ML & Statistics (5 Problems)

These problems test practical ML decision-making and statistical reasoning. There is no code to write --- just structured thinking and clear communication.

#ProblemDifficultyTimeKey PatternWhat It TestsCompany TagsHandbook Chapter
41Debug a Model That Is Not ConvergingMedium25 minSystematic debuggingData, model, optimization checklist approachFAANG, AllML Fundamentals
42Detect and Mitigate Data LeakageMedium25 minTemporal, feature leakageThe #1 cause of offline-online metric gapsAllML Fundamentals
43Compare Online vs. Offline Metrics DiscrepancyMedium25 minDistribution shift, delayed feedbackThe classic MLE debugging scenarioMeta, Google, UberML Fundamentals
44Design a Model Retraining StrategyMedium25 minTrigger-based vs. scheduledModel decay detection and automated retrainingFAANG, Big TechML System Design
45Explain Random Forest vs. Gradient Boosting: When to Use EachMedium20 minEnsemble comparisonPractical model selection for tabular dataAllML Fundamentals

Problem Deep Dives

Each deep dive gives you the full solution approach, code template, and interviewer expectations so you can practice realistically.

Problem 1: 3Sum

Why this problem matters: 3Sum is the gateway to the two-pointer pattern. Once you master it, you can solve 4Sum, 3Sum Closest, and a family of related problems. It also tests your ability to handle duplicate elements cleanly.

Approach:

1. Sort the array
2. Fix one element (i), use two pointers (lo, hi) on the rest
3. Skip duplicates at every level to avoid duplicate triplets
4. Time: O(n^2), Space: O(1) excluding output

Code Template:

def three_sum(nums):
nums.sort()
result = []
for i in range(len(nums) - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue # skip duplicate anchor
lo, hi = i + 1, len(nums) - 1
while lo < hi:
total = nums[i] + nums[lo] + nums[hi]
if total < 0:
lo += 1
elif total > 0:
hi -= 1
else:
result.append([nums[i], nums[lo], nums[hi]])
while lo < hi and nums[lo] == nums[lo + 1]:
lo += 1 # skip duplicates
while lo < hi and nums[hi] == nums[hi - 1]:
hi -= 1 # skip duplicates
lo += 1
hi -= 1
return result

Key Points Interviewers Check:

  • Sorting as a prerequisite for two pointers
  • Duplicate skipping at both the outer loop and inner pointers
  • Correct termination conditions
  • Can you extend to k-Sum? (Recursive generalization)

Problem 8: LRU Cache

Why this problem matters: LRU Cache is the #1 most-asked medium design problem. It tests whether you can combine two data structures to achieve O(1) operations, and it is directly applicable to feature caching, model result caching, and embedding lookup caching in ML systems.

Data Structure:

Hash Map: key -> Node pointer (O(1) lookup)
Doubly-Linked List: maintains access order (O(1) move/remove)

Operations:

class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.prev = None
self.next = None

class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.cache = {} # key -> Node
self.head = Node(0, 0) # dummy head
self.tail = Node(0, 0) # dummy tail
self.head.next = self.tail
self.tail.prev = self.head

def get(self, key):
if key in self.cache:
node = self.cache[key]
self._remove(node)
self._add(node) # move to front
return node.val
return -1

def put(self, key, value):
if key in self.cache:
self._remove(self.cache[key])
node = Node(key, value)
self._add(node)
self.cache[key] = node
if len(self.cache) > self.capacity:
lru = self.head.next
self._remove(lru)
del self.cache[lru.key]

def _add(self, node):
# Add before tail (most recent)
prev = self.tail.prev
prev.next = node
node.prev = prev
node.next = self.tail
self.tail.prev = node

def _remove(self, node):
prev = node.prev
nxt = node.next
prev.next = nxt
nxt.prev = prev

Key Points Interviewers Check:

  • O(1) for both get and put operations
  • Correct eviction of the least recently used item
  • Handling of duplicate keys (update, not duplicate)
  • Thread safety discussion for production use

ML Relevance: Feature stores cache frequently accessed features. Model serving caches recent predictions. Embedding lookup tables use LRU eviction. If you can explain the ML connection, you stand out.

Problem 16: Implement Batch Gradient Descent with Mini-Batches

Why this problem matters: Every neural network trains with mini-batch gradient descent. Interviewers want to see that you understand the mechanics beyond calling model.fit().

Code Template:

import numpy as np

def mini_batch_gradient_descent(X, y, lr=0.01, batch_size=32, epochs=100):
n_samples, n_features = X.shape
weights = np.zeros(n_features)
bias = 0.0

for epoch in range(epochs):
# Shuffle data each epoch
indices = np.random.permutation(n_samples)
X_shuffled = X[indices]
y_shuffled = y[indices]

for start in range(0, n_samples, batch_size):
end = min(start + batch_size, n_samples)
X_batch = X_shuffled[start:end]
y_batch = y_shuffled[start:end]

# Forward pass
predictions = X_batch @ weights + bias

# Compute gradients
error = predictions - y_batch
grad_w = (2 / len(y_batch)) * (X_batch.T @ error)
grad_b = (2 / len(y_batch)) * np.sum(error)

# Update
weights -= lr * grad_w
bias -= lr * grad_b

return weights, bias

Key Points Interviewers Check:

  • Shuffle data each epoch (not just once)
  • Correct gradient computation (vectorized, not looped)
  • Batch size handling for the last (potentially smaller) batch
  • Numerical stability discussion (gradient clipping, learning rate warmup)
  • Can you extend to momentum, Adam, or weight decay?

Problem 20: Implement Decision Tree (ID3/CART)

Why this problem matters: Decision trees are the foundation of gradient boosting (XGBoost, LightGBM), the most dominant algorithm for tabular data in industry. Implementing one from scratch proves you understand feature selection, splitting criteria, and recursive structure.

Code Template:

import numpy as np

def entropy(y):
counts = np.bincount(y)
probs = counts[counts > 0] / len(y)
return -np.sum(probs * np.log2(probs))

def information_gain(y, mask):
parent = entropy(y)
n = len(y)
left, right = y[mask], y[~mask]
if len(left) == 0 or len(right) == 0:
return 0
child = (len(left) / n) * entropy(left) + (len(right) / n) * entropy(right)
return parent - child

def best_split(X, y):
best_gain = 0
best_feature, best_threshold = None, None
for feature in range(X.shape[1]):
thresholds = np.unique(X[:, feature])
for threshold in thresholds:
mask = X[:, feature] <= threshold
gain = information_gain(y, mask)
if gain > best_gain:
best_gain = gain
best_feature = feature
best_threshold = threshold
return best_feature, best_threshold

def build_tree(X, y, depth=0, max_depth=5):
if len(np.unique(y)) == 1 or depth >= max_depth:
return {'leaf': True, 'prediction': np.bincount(y).argmax()}

feature, threshold = best_split(X, y)
if feature is None:
return {'leaf': True, 'prediction': np.bincount(y).argmax()}

mask = X[:, feature] <= threshold
return {
'leaf': False,
'feature': feature,
'threshold': threshold,
'left': build_tree(X[mask], y[mask], depth + 1, max_depth),
'right': build_tree(X[~mask], y[~mask], depth + 1, max_depth),
}

Key Points Interviewers Check:

  • Correct entropy/Gini computation
  • Efficient threshold selection (sort once, scan)
  • Stopping criteria (max depth, min samples, pure node)
  • Can you extend to regression? (Variance reduction instead of information gain)

Problem 33: Sessionize Clickstream Data

Why this problem matters: This is the most commonly asked SQL problem for any data-adjacent role. It combines window functions, conditional logic, and the cumulative sum trick.

Solution:

WITH time_gaps AS (
SELECT
user_id,
event_time,
event_time - LAG(event_time) OVER (
PARTITION BY user_id ORDER BY event_time
) AS gap
FROM events
),
session_flags AS (
SELECT
*,
CASE
WHEN gap IS NULL OR gap > INTERVAL '30 minutes' THEN 1
ELSE 0
END AS new_session
FROM time_gaps
)
SELECT
user_id,
event_time,
SUM(new_session) OVER (
PARTITION BY user_id ORDER BY event_time
) AS session_id
FROM session_flags;

The Cumulative Sum Trick: Flag every session boundary with 1, then take a running SUM. Each session gets a unique incrementing ID. This pattern applies to any "group consecutive events" problem.

Key Points Interviewers Check:

  • Correct use of LAG with PARTITION BY and ORDER BY
  • Handling NULL for the first event (no previous event to compare)
  • Configurable session timeout (not hardcoded)
  • Can you extend to compute session duration and session-level aggregates?

Problem 41: Debug a Model That Is Not Converging

Why this problem matters: Every ML engineer has faced a model that refuses to converge. Interviewers test whether you have a systematic debugging approach or just guess randomly.

Structured Debugging Checklist:

StepCheckWhat to Look For
1DataAre labels correct? Is there class imbalance? Are features normalized?
2Loss functionDoes the loss match the problem type? Is it numerically stable?
3Learning rateToo high (oscillating)? Too low (flat)? Try LR finder.
4Gradient flowAre gradients vanishing or exploding? Check gradient norms per layer.
5ArchitectureIs the model capacity sufficient? Too small underfits, too large memorizes noise.
6InitializationAre weights initialized correctly for this activation function?
7Overfit one batchCan the model memorize 1 batch perfectly? If not, there is a bug.
8Data pipelineAre inputs and labels aligned after shuffling? Is preprocessing applied correctly?

The One-Batch Test: Before debugging anything else, try to overfit a single batch of 8-16 examples. If the model cannot drive loss to near zero on a tiny batch, the problem is in the model or training code, not in the data. This single test eliminates half of all debugging directions.

5-Week Medium Tier Study Plan

WeekFocusProblemsDaily Load
Week 1DSA coding#1-15 (all coding problems)2-3 problems/day
Week 2ML implementation#16-23 (ML coding)1-2 problems/day
Week 3System design + SQL#24-35 (design + data)1-2 problems/day
Week 4NumPy/Pandas + Applied ML#36-45 (data processing + applied)1-2 problems/day
Week 5Integration + mocksRevisit weak areas + full mocks1 problem + mocks

Week 1: DSA Coding

Day 1: #1, #2 (3Sum, Group Anagrams - sorting and hashing patterns)
Day 2: #3, #4 (Product Except Self, Longest Substring - prefix and sliding window)
Day 3: #5, #6, #7 (Container With Most Water, Rotate Image, Spiral Matrix)
Day 4: #8 (LRU Cache - spend extra time, this is critical)
Day 5: #9, #10 (Islands, Course Schedule - graph fundamentals)
Day 6: #11, #12 (Level order, Meeting Rooms II - BFS and intervals)
Day 7: #13, #14, #15 (Coin Change, Rate Limiter, Top K)

Week 2: ML Implementation

Day 1: #16 (Mini-batch gradient descent - take your time, understand every line)
Day 2: #17, #18 (TF-IDF, AUC-ROC - text features and evaluation)
Day 3: #19, #20 (Stratified K-Fold, Decision Tree - evaluation and trees)
Day 4: #21, #22 (Welford's algorithm, Reservoir Sampling - online algorithms)
Day 5: #23 (Learning rate scheduling - training optimization)
Day 6: Review all ML problems; re-solve weak ones from scratch
Day 7: Timed practice - pick 3 random ML problems, solve each in 25 minutes

Week 3: System Design + SQL

Day 1: #24 (Product recommendations - the canonical system design problem)
Day 2: #25, #26 (Spam detection, credit risk - classification systems)
Day 3: #27, #28 (Anomaly detection, A/B testing - monitoring and experimentation)
Day 4: #29, #30 (Feature pipeline, document classification)
Day 5: #31, #32 (Nth salary, retention cohorts - window functions)
Day 6: #33, #34, #35 (Sessionization, MERGE, funnel analysis)
Day 7: Review all designs; practice explaining out loud with a timer

Week 4: NumPy/Pandas + Applied ML

Day 1: #36, #37 (Schema validation, incremental loader)
Day 2: #38, #39 (Nested JSON, deduplication)
Day 3: #40 (Rolling statistics with GroupBy)
Day 4: #41, #42 (Debug non-convergence, data leakage)
Day 5: #43, #44 (Online/offline gap, retraining strategy)
Day 6: #45 (RF vs GBT comparison)
Day 7: Review and re-solve weak problems from all categories

Week 5: Integration + Mocks

Day 1: Full mock - coding (25 min) + ML implementation (25 min)
Day 2: Full mock - system design (40 min) + SQL (20 min)
Day 3: Full mock - applied ML discussion (30 min) + coding (25 min)
Day 4: Targeted review of any problems you could not solve cleanly
Day 5: Full mock - complete interview loop simulation (3 hours)
Day 6: Full mock - complete interview loop simulation (3 hours)
Day 7: Final review of all weak areas; light practice only

:::note Mock Interview Protocol For realistic mock practice:

  • Use a timer visible on your screen
  • Explain your approach out loud before coding (even when alone)
  • Write code in a plain text editor (no autocomplete)
  • After finishing, review your solution as if you were the interviewer
  • Track your solve rate and time per problem in a spreadsheet :::

Medium-Tier Patterns Cheat Sheet

Master these 20 patterns and you can solve any medium problem:

#PatternProblemsRecognition Signal
1Two Pointers (sorted)#1, #5Sorted input, find pair/triplet with sum
2Sliding Window#4Contiguous subarray/substring with constraint
3Hash Map Grouping#2, #8Group items by equivalence class
4Prefix/Suffix#3Need left and right context for each element
5Matrix Manipulation#6, #7In-place 2D transformations
6BFS/DFS Grid#9Connected components in 2D grid
7Topological Sort#10Dependencies, prerequisites, ordering
8Level-order BFS#11Process tree level by level
9Interval Processing#12Overlapping intervals, scheduling
10Bottom-up DP#13Optimal value with overlapping subproblems
11Heap / Priority Queue#15Top-K, streaming max/min
12Window Functions (SQL)#31, #32, #33, #35Ranking, running totals, LAG/LEAD
13Gradient Computation#16, #23Training loop, optimization
14Threshold Sweep#18AUC, precision-recall curves
15Recursive Partitioning#20Decision trees, divide-and-conquer
16Online Algorithms#21, #22Streaming computation, bounded memory
17Multi-stage Pipeline#24, #25Retrieval -> ranking -> reranking
18Feature Store Design#29Online/offline consistency
19A/B Test Design#28, #35Hypothesis, metrics, sample size
20Debug Checklist#41, #42, #43Systematic elimination of failure modes

Common Mistakes by Category

Knowing what goes wrong is as important as knowing the right answer.

Coding Mistakes

MistakeWhy It HappensHow to Fix
Off-by-one in binary searchUnclear on inclusive/exclusive boundsAlways write lo, hi = 0, len(arr) - 1 and use while lo <= hi
Modifying input while iteratingNot creating a copyUse index-based iteration or build new output
Not handling empty inputAssumption that input has at least 1 elementAdd explicit check at the start
Forgetting to skip duplicatesNot thinking about output uniquenessAdd duplicate-skipping logic after every valid result

ML Implementation Mistakes

MistakeWhy It HappensHow to Fix
Using for-loops over data pointsNot thinking in vectorsRewrite with matrix operations: X.T @ error not for x in X
Wrong gradient signConfusion between minimize and maximizeDerive gradient on paper first, verify with finite differences
Not shuffling dataForgetting that order mattersShuffle indices at the start of each epoch
Ignoring numerical stabilityNot thinking about log(0) or exp(large)Use np.clip, logsumexp, add epsilon to denominators

System Design Mistakes

MistakeWhy It HappensHow to Fix
No monitoring planFocusing only on building, not operatingAlways end with "what can go wrong and how do we detect it"
Ignoring data pipelineJumping straight to model architectureSpend 30% of your time on data: collection, cleaning, features
Not discussing tradeoffsPresenting one approach as the only optionFor every choice, explain what you considered and why you chose this
Skipping latency requirementsNot thinking about serving constraintsState latency budget upfront and design backwards from it

SQL Mistakes

MistakeWhy It HappensHow to Fix
GROUP BY errorsSelecting non-aggregated columnsEvery non-aggregated column must be in GROUP BY
Window function confusionMixing up PARTITION BY and GROUP BYPARTITION BY does not reduce rows; GROUP BY does
Self-join pitfallsCartesian explosion on large tablesAlways check join conditions produce expected row count
NULL handlingForgetting that NULL != NULLUse IS NULL / IS NOT NULL; COALESCE for defaults

Difficulty Calibration Guide

How to know if you are solving medium problems at interview pace:

MetricBelow ParOn TrackInterview Ready
Solve time (coding)>35 min20-30 min<20 min
Solve time (ML implementation)>30 min20-25 min<20 min
Solve time (SQL)>25 min15-20 min<15 min
System design coverageMiss 2+ componentsCover all componentsDeep dive on 1-2
Bug-free rate<50%70-80%>85%
Can explain complexityRarelyUsuallyAlways

:::danger Signs You Need More Easy Practice First

  • You cannot solve #1 (3Sum) in under 30 minutes
  • You do not know what a window function is before attempting SQL problems
  • You cannot implement gradient descent from the math
  • You do not understand BFS vs. DFS conceptually

If any of these apply, spend a week on the Easy Tier first. Building on shaky fundamentals wastes time. :::

Time Allocation Strategy

Not all categories deserve equal time. Prioritize based on your target role:

RoleDSAML ImplSystem DesignSQL/DataApplied ML
MLE30%25%25%10%10%
AI Engineer25%30%20%10%15%
Data Scientist15%20%15%30%20%
MLOps Engineer20%10%35%20%15%
Data Engineer25%5%25%35%10%

Scoring Rubric

Use this rubric to self-assess after each practice problem:

ScoreCriteriaWhat It Means
5 - PerfectSolved in under target time, bug-free, discussed complexity and tradeoffsYou are interview ready for this problem type
4 - StrongSolved in target time with minor bugs, caught them during reviewNearly ready, practice for speed
3 - AdequateSolved with hints or slightly over time, correct final answerNeed more practice with this pattern
2 - WeakNeeded significant hints, major bugs, over timeStudy the pattern, re-solve from scratch tomorrow
1 - Did not solveCould not reach a working solutionFoundational gap - review the underlying concept first

Track your scores over time. Your goal is to score 4 or 5 on every problem in this list before your interview.

Next Steps

After completing the Medium Tier:

© 2026 EngineersOfAI. All rights reserved.