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.

316 Questions 72 Companies08.05.2026
Showing 20 results
Role
Nextdoor logo
Nextdoor
Medium
Machine Learning Engineer

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

Coding & Algorithms
12
0
97 people solved
Sep 6, 2025
UiPath logo
UiPath
Medium
Machine Learning Engineer

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

Coding & Algorithms
4
0
34 people solved
Sep 6, 2025
Uber logo
Uber
Medium
Machine Learning Engineer

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

Coding & Algorithms
14
0
117 people solved
Sep 6, 2025
TikTok logo
TikTok
Medium
Machine Learning Engineer

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

Coding & Algorithms
3
0
28 people solved
Sep 6, 2025
Meta logo
Meta
Medium
Machine Learning Engineer

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

Coding & Algorithms
5
0
46 people solved
Sep 6, 2025
Meta logo
Meta
Medium
Machine Learning Engineer

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

Coding & Algorithms
2
0
34 people solved
Sep 6, 2025
Meta logo
Meta
Medium
Machine Learning Engineer Locked

Solve sampling and streaming tasks

This question evaluates algorithmic problem-solving, data structure design, probabilistic reasoning for weighted random selection, sliding-window stri...

Coding & Algorithms
1
0
29 people solved
Sep 4, 2025
Apple logo
Apple
Medium
Machine Learning Engineer

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

Coding & Algorithms
16
0
131 people solved
Aug 13, 2025
TikTok logo
TikTok
Medium
Machine Learning Engineer

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

Coding & Algorithms
3
0
26 people solved
Aug 8, 2025
UiPath logo
UiPath
Medium
Machine Learning Engineer

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

Coding & Algorithms
2
0
25 people solved
Aug 7, 2025
TikTok logo
TikTok
Medium
Machine Learning Engineer

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

Coding & Algorithms
4
0
33 people solved
Aug 7, 2025
Capital One logo
Capital One
Medium
Machine Learning Engineer

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

Coding & Algorithms
4
0
11 people solved
Aug 4, 2025
OpenAI logo
OpenAI
Medium
Machine Learning Engineer

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

Coding & Algorithms
66
0
501 people solved
Aug 4, 2025
DRW logo
DRW
Medium
Machine Learning Engineer

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

Coding & Algorithms
3
0
42 people solved
Aug 4, 2025
TikTok logo
TikTok
Medium
Machine Learning Engineer

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

Coding & Algorithms
10
0
10 people solved
Aug 4, 2025
Meta logo
Meta
Medium
Machine Learning Engineer

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

Coding & Algorithms
9
0
70 people solved
Aug 4, 2025
Meta logo
Meta
Medium
Machine Learning Engineer

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

Coding & Algorithms
2
0
34 people solved
Jul 31, 2025
TikTok logo
TikTok
Medium
Machine Learning Engineer

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

Coding & Algorithms
4
0
30 people solved
Jul 27, 2025
Amazon logo
Amazon
Medium
Machine Learning Engineer

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

Coding & Algorithms
1
0
28 people solved
Jul 17, 2025
LinkedIn logo
LinkedIn
Medium
Machine Learning Engineer

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

Coding & Algorithms
10
0
95 people solved
Jul 16, 2025

Explore more Machine Learning Engineer Coding & Algorithms interview questions

Real questions from candidate reports, grouped by company, topic and role.

By company
Other categories for Machine Learning Engineer
Coding & Algorithms questions for other roles
Browse all