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."
Find LCA in a tree and extend to a DAG
Part A — LCA variant in a rooted tree You are given a rooted tree with n nodes labeled 0..n-1. Input: - parent[i] for each node i (parent[root] = -1)....
Implement bounds, minimum, pathfinding, and moving average
Solve the following data-structures problems: ( 1) Given two sorted integer lists A and B, merge them into a single non-decreasing array. Then, for a ...
Find longest substring without repeating characters
Problem Given a string s, find the length of the longest contiguous substring that contains no repeated characters. Input - A string s (may contain le...
Generate Instructions for a Blind Maze Robot
You are given a known 2D maze grid with m rows and n columns. Each cell is one of: - #: wall - .: empty cell - E: the exit, which appears exactly once...
Simulate Grid Infection
Implement a grid infection simulator. Base problem: - You are given a 2D grid. - X means infected. - . means healthy. - Each day, every currently infe...
Compute moving and weighted averages from a stream
You are processing a stream of numeric events (e.g., user activity counts). You are given a fixed window size X. Part 1: Moving average over last X va...
Implement Streaming Word Counter
Implement a class that records word frequencies from a stream of text. The class should support the following operations: 1. add_text(text: str) -> No...
Compute currency conversion via graph search
Given a list of currency pairs, e.g., [('USD','CAD'), ('CAD','EUR'), ...], and a parallel list of conversion ratios [1.1, 1.2, ...] where ratio r mean...
Write pseudocode for a ReAct-style loop
Coding prompt (pseudocode) Write pseudocode (does not need to compile) for a ReAct-style agent loop that alternates between reasoning and actions. Req...
Compute binary tree left-side view
Given a binary tree, return the values visible from the left side when looking from top to bottom. If multiple nodes exist at the same depth, the left...
Implement exponentiation and link tree neighbors
Solve two independent tasks. Task A — Fast exponentiation: Implement fastExponent(x, n) that returns x raised to the integer power n, where x is a dou...
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...
Detect cycles and order with DFS
You are given a directed graph of package dependencies represented as an adjacency list: Map<String, List<String>> deps where deps[p] lists packages t...
Simulate a rover fleet
Implement a simulator for autonomous rovers moving on a rectangular grid. You are given: - The grid size width x height - A set of blocked cells repre...
Solve sampling and streaming tasks
Implement the following algorithmic tasks: 1. Weighted random selection: You are given an array of positive integer weights w, where w[i] is the relat...
Implement scaled dot-product attention
Task In this interview you are asked to hand-write the forward pass of attention from the mathematical formula (no need to run code). Implement single...
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...
Optimize repeated-value vectors and compute exclusive times
You are given two separate coding tasks from an interview. Task 1: Optimize storage for vectors with repeated values, then compute dot product You are...
Implement cache and merge intervals
The interview included two coding tasks: 1. Implement a fixed-capacity key-value cache with get(key) and put(key, value). Both operations must run in ...
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...