Machine Learning Engineer Coding & Algorithms Interview Questions
Practice 316 real Coding & Algorithms interview questions for Machine Learning Engineer roles. From companies including Meta, Amazon, OpenAI, 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 ordering with dependency constraints
You are given n items labeled 0..n−1 and a list of precedence constraints edges[i] = [u, v] meaning u must appear before v. Return a valid ordering of...
Implement cocktail shaker sort and analyze
Implement the cocktail shaker sort (bidirectional bubble sort) for an array of integers. Optimize it with early termination and shrinking bounds, and ...
Design room progression with leaderboard
Design a data structure to simulate a sequence of rooms where players solve tasks and can move only to the next room once finished. Support the follow...
Determine frog reachability across stones
You are given a sorted array of distinct integers stones representing stone positions in a river, where stones[0] = 0. A frog starts on stone 0; its f...
Return k smallest elements using heap
Given an unsorted array nums of up to 1,000,000 integers and an integer k (1 <= k <= nums.length), return the k smallest elements in ascending order. ...
Maximize one stock trade profit
You're given an array prices of length n where prices[i] is the stock price on day i. You may complete at most one transaction (buy once, then sell la...
Solve sampling and streaming tasks
This question evaluates algorithmic problem-solving, data structure design, probabilistic reasoning for weighted random selection, sliding-window stri...
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...
Fix a BST with two misplaced keys
Fix a BST with two misplaced keys You are given the root of a binary search tree in which exactly two nodes’ keys were accidentally swapped. Restore t...
Compute Minimum L-Moves on Infinite Grid
Compute Minimum L-Moves on Infinite Grid On an infinite 2D grid, a chess-like piece moves in L-shapes: from (x, y) it can go to (x±1, y± 2) or (x±2, y...
Find second-minimal word segmentation count
Find second-minimal word segmentation count Given a string s and a dictionary D of non-empty words, define a 'segmentation' as splitting s into a sequ...
Solve matrix rotation and 1-D illumination
Question LeetCode 48. Rotate Image – rotate an n×n matrix 90° clockwise (extra space allowed). Find the point(s) with the maximum number of illuminate...
Find earliest supporting dependency version
Question Given a list of dependency versions (e.g. [103.003.02, 103.003.03, 203.003.02]) and a black-box API isSupported(v), design an algorithm to fi...
Implement portfolio optimization simulation
Question Given price-return time series in a DataFrame, simulate random portfolio weights, compute expected return, volatility, Sharpe ratio, and retu...
Count subarrays summing to target
Question LeetCode 560. Subarray Sum Equals K – Given an integer array nums and an integer k, return the total number of continuous subarrays whose sum...
Check diagonal and compute window statistics
Question Given a square matrix, determine whether all elements on its main diagonal are identical. LeetCode 346. Moving Average from Data Stream – des...
Compute sliding-window medians
Given an array nums and an integer k, compute the median for each contiguous subarray (window) of length k and return the sequence of medians in order...
Compute city skyline silhouette
Compute city skyline silhouette Compute the outer silhouette of a 2D skyline. You are given n axis-aligned rectangular buildings; each building i is (...
Implement inventory allocation with backorders
Implement inventory allocation with backorders Design and implement a function to process an event stream for an e-commerce marketplace. Input: ( 1) i...
Find shortest word transformation with caching
Find shortest word transformation with caching You are given a start word and an end word of equal length, and a dictionary of valid words. In one mov...