Machine Learning Engineer Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.

"10 years of experience but never worked at a top company. PracHub's senior-level questions helped me break into FAANG at 35. Age is just a number."

"I was skeptical about the 'real questions' claim, so I put it to the test. I searched for the exact question I got grilled on at my last Meta onsite... and it was right there. Word for word."

"Got a Google recruiter call on Monday, interview on Friday. Crammed PracHub for 4 days. Passed every round. This platform is a miracle worker."

"I've used LC, Glassdoor, and random Discords. Nothing comes close to the accuracy here. The questions are actually current — that's what got me. Felt like I had a cheat sheet during the interview."

"The solution quality is insane. It covers approach, edge cases, time complexity, follow-ups. Nothing else comes close."

"Legit the only resource you need. TC went from 180k -> 350k. Just memorize the top 50 for your target company and you're golden."

"PracHub Premium for one month cost me the price of two coffees a week. It landed me a $280K+ starting offer."

"Literally just signed a $600k offer. I only had 2 weeks to prep, so I focused entirely on the company-tagged lists here. If you're targeting L5+, don't overthink it."

"Coaches and bootcamp prep courses cost around $200-300 but PracHub Premium is actually less than a Netflix subscription. And it landed me a $178K offer."

"I honestly don't know how you guys gather so many real interview questions. It's almost scary. I walked into my Amazon loop and recognized 3 out of 4 problems from your database."

"Discovered PracHub 10 days before my interview. By day 5, I stopped being nervous. By interview day, I was actually excited to show what I knew."
"The search is what sold me. I typed in a really niche DP problem I got asked last year and it actually came up, full breakdown and everything. These guys are clearly updating it constantly."
Compute time to infect all cells
You are given an n × m grid representing people in a city. - Each cell is either infected (1) or healthy (0). - Two cells are neighbors if they share ...
Compute point-to-segment minimum distance
Problem Given a 2D point P(x, y) and a line segment with endpoints A(x1, y1) and B(x2, y2), compute the minimum Euclidean distance from point P to the...
Sample index from probability distribution
You are given a discrete probability distribution for an \(M\)-sided die as an array p[0..M-1], where each p[i] is non-negative. Design a function sam...
Minimize batches and allocate riders by time
Coding prompts (same interview round) 1) Minimum number of batches for time points You are given a list of event time points (integers), e.g. [1, 3, 5...
Find shortest path in a maze grid
Maze shortest path You are given a 2D grid maze of size m x n where: - 0 represents an open cell - 1 represents a wall (cannot pass) You are also give...
Implement a web crawler using a provided API
Web Crawler (BFS) You are implementing a simple web crawler. Given - A starting URL startUrl. - A provided API: - List<String> getUrls(String url) w...
Compute sum over consecutive-step subarrays
Given an integer array a of length n, call a subarray a[l..r] good if either: - it is strictly increasing by 1 at every step: a[i+1] - a[i] = 1 for al...
Design O(1) cache and moving average
Problem You are asked two coding questions: 1) O(1) cache data structure Design a data structure that supports the following operations in O(1) averag...
Implement an LRU Cache
Problem Design and implement an LRU (Least Recently Used) Cache that supports the following operations in O(1) average time: - get(key): - Return th...
Find two numbers summing to target without hashmap
Problem Given an integer array nums (length n) and an integer target, return the indices (i, j) such that: - i != j - nums[i] + nums[j] == target You ...
Implement K-means clustering from scratch
Task Implement K-means clustering from scratch (no ML libraries). You are given a dataset of points: - Input: an array X of shape (n, d) (n points, ea...
Implement 2D convolution forward pass
Problem Implement the forward pass of a 2D convolution (conv2d) from scratch (no deep learning libraries). You are given: - Input tensor x with shape ...
Choose K pickup locations minimizing L1 distance
Coding: K Shuttle Pickup Locations (L1) You are given the coordinates of N people on a 2D grid. You want to open K shuttle pickup locations (pickup po...
Convert stack samples to execution trace
You are given sampling-profiler output: a list of Sample objects ordered by timestamp ascending. Each Sample has (t: float, stack: list[str]) where st...
Solve OA tasks on string, grid path, subarrays
You are given three independent coding tasks. Task 1: Reverse the middle if ends are vowels Given a string s (ASCII letters), if both the first and la...
Implement multi-head attention and LLM sampling
Task A: Multi-head attention (forward pass) You are implementing a Transformer attention layer. Given: - A sequence length L and model dimension d_mod...
Deep copy a linked list with random pointers
Problem You are given the head of a linked list where each node has: - val: integer value - next: pointer to the next node (or null) - random: pointer...
Generate all hyperparameter combinations
You are given several groups of hyperparameter choices for an ML experiment. Each group contains one hyperparameter name and a list of candidate value...
Design a robot movement command system
Robot Movement (Pair Programming) You are given an empty starter repository (only a README). Implement a small, testable robot movement module that ca...
Find earliest supporting version under constraints
You are given version strings formatted as {major}.{minor}.{patch}, e.g., "103.003.03". Each version either supports a feature or not. You may call is...