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

"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."
Compute Roller Coaster Scores
You are given a list of roller coaster descriptions. Each description is a string in the format: <CoasterType> <MaxSpeed> <BumpsPerSecond> <LiftType> ...
Implement a Referral Revenue Tracker
Implement an in-memory revenue tracking system for customers in a referral network. Each customer has their own direct revenue. A customer may also ha...
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...
Solve Two String Problems
The interview included two coding questions: 1. Exactly one edit apart Given two strings s and t, determine whether they are exactly one edit apart...
Solve Four Coding Assessment Tasks
Complete the following four independent coding tasks. 1. Find the day a cumulative visit target is reached You are given an array visits, where visits...
Implement SFT Sample Packing
Implement a preprocessing function for supervised fine-tuning data for an autoregressive language model. You are given a list of tokenized training sa...
Find First Local Minimum
Given an integer array nums, find the index of the first local minimum. A local minimum is an element that is smaller than its immediate neighbors: - ...
Count People Reaching the Boundary
You are given a 1-dimensional line segment with a right boundary at position L. There are N people with initial positions p1, p2, ..., pN, and there i...
Wrap Matching Substrings in Bold Tags
During a machine learning engineer phone screen, the coding task was: You are given a string text and a list of strings patterns. Return a new string ...
Implement Layer History and Grid Counting
The coding portion covered two independent tasks. 1. Implement a simplified layer editor for a design tool. The editor maintains an ordered list of la...
Simulate Infection Spread on a Grid
You are given an m x n grid representing cells in a population. Each day, all state changes happen simultaneously. Infection neighbors are the 8 surro...
Find target-heavy sliding windows
Given an integer array nums, an integer target, and a fixed window size k, solve the following two tasks: 1. Return all contiguous subarrays of length...
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...
Sample a string by real-valued scores
You are given: - A list of strings texts (e.g., user comments), length n. - A list of floating-point scores scores of length n, where each score can b...
Can you reach target with distance-threshold edges?
You are given a set of unordered 2D points points[], a start point and an end point (both are included in points), and a function: `text getDistance(p...
Implement one-cluster k-means
Given n points in d-dimensional space, implement k-means clustering with squared Euclidean distance for the special case k = 1. Return the single cent...
Optimize a Fifteen-Sum Card Strategy
You are given a simulator for a card game with 36 cards: ranks 1 through 9 in four suits. The table starts with 16 random cards. A move removes any 3 ...
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...
Convert State Stream to Events
You are given an array states where states[i] is the categorical output of a monitoring function at timestamp i. Consecutive equal values belong to th...
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...