Machine Learning Engineer Coding & Algorithms Interview Questions
Practice 300 real Coding & Algorithms interview questions for Machine Learning Engineer roles. From companies including Meta, OpenAI, Amazon, TikTok, Pinterest.

"I got asked a hardcore MCM DP question and I saw it on PracHub as well. Solved that question in 5 minutes. Without PracHub I doubt I could solve it in 5 hours. Though somehow didn't get hired, perhaps I guess I solved it too fast? /s"

"Believe me i'm a student here jn US. Recently interviewed for MSFT. They asked me exact question from PracHub. I saw it the night before and ignored it cause why waste time on random sites. I legit wanna go back and redo this whole thing if I had chance. Not saying will work for everyone but there is certainly some merit to that website. And i'm gonna use it in future prep from now on like lc tagged"

"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."

"I recently cleared Uber interviews (strong hire in the design round) and all the questions were present in prachub."
"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."
Implement local maxima, bagging, and k-means
You have 70 minutes for three programming tasks. Task 1 — Find local maxima Given an integer array a of length n (1 <= n <= 2e5), return all indices i...
Solve Two Sorted-Array Tasks
Implement solutions for the following two array problems: 1. Sorted values, return sorted squares You are given an integer array sorted in non-de...
Implement exponentiation and fill grid distances
You are given two separate coding tasks. Task 1: Implement fast exponentiation Implement a function pow(x, n) that returns \(x^n\). - Input: - x: a ...
Implement integer division without using division
You are given two 32-bit signed integers dividend and divisor. Implement a function that divides dividend by divisor and returns the integer quotient,...
Implement Linear Regression Training
Implement a function train_linear_regression(X, y, lr, epochs) that trains a linear regression model from scratch using batch gradient descent. Requir...
Compute array products excluding self and top-k
Algorithms 1) Product of array except self (no division) Given an integer array nums of length n, return an array ans where: - ans[i] = product of all...
Implement bag-of-words similarity search from scratch
Implement a bag-of-words–based text similarity search engine from scratch. Write code that: ( 1) tokenizes text (lowercasing, punctuation handling, Un...
Solve Decimal Coin Change
Given a list of coin denominations represented as decimal values and a target amount represented as a decimal value, return the minimum number of coin...
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 Optimal Bucket Batching
You are given an array lengths of K document lengths and an integer G representing the number of available GPUs. A batch is assigned to one GPU, and e...
Compute minimal time to finish dependent tasks
Coding: Task Scheduling With Prerequisites (Parallel Allowed) You have n tasks labeled 1..n. Each task takes exactly 1 unit of time to complete. Some ...
Convert Samples into Event Intervals
You are given a time-ordered array samples, where samples[i] is the function name observed at integer timestamp i. Convert this trace into a list of e...
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...
Support room moves and query top-k fastest
Problem There are R rooms labeled 0..R-1 (in increasing order), and P people labeled 0..P-1. - Initially, all people are in room 0. - Operation move(p...
Find Top K Largest Elements
Given an unsorted integer array nums of length N and an integer k such that 1 <= k <= N, return the k largest elements in the array. If a value appear...
Maximize grid-path expression and count sawtooth subarrays
Problem 1: Maximize a valid expression along a grid path You are given an m x n grid grid. Each cell contains either: - an operator: '+' or '-', or - ...
Sample index from weighted probability distribution
Given an array weights[0..M-1] representing a discrete distribution over M outcomes, implement a function sampleIndex(weights) that returns an index i...
Compute minimum path sum in a triangle
Given a triangle of integers represented as a list of rows, find the minimum path sum from the top to the bottom. - From row r and index c, you may mo...
Simulate bubble elimination and maximize common prefix
You are given two independent coding tasks (as in a multi-question OA). Solve each. Task A — Grid “bubble/candy” elimination simulation You are given ...
Implement string-based rounding without floats
Coding You are not allowed to parse the input into a built-in floating type (to avoid overflow and precision issues). Work directly on strings. 1) Imp...