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
Bytedance logo
Bytedance
Hard
Machine Learning Engineer

Count Special Subarrays by Modular Frequency

You are given an integer array nums, and two integers modulo and target, where 0 <= target < modulo. Call an index i special if nums[i] % modulo == ta...

Coding & Algorithms
0
0
8 people solved
Oct 8, 2025
TikTok logo
TikTok
Medium
Machine Learning Engineer

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

Coding & Algorithms
2
0
38 people solved
Sep 29, 2025
Zillow logo
Zillow
Medium
Machine Learning Engineer

Implement k-th largest in a number stream

You are designing a small library to monitor statistics over a stream of integers. Implement a data structure that, given an integer k and an initial ...

Coding & Algorithms
2
0
29 people solved
Sep 24, 2025
xAI logo
xAI
Medium
Machine Learning Engineer

Implement dynamic batching for token decoding

You are given a black-box “simulated language model” interface that can advance many sequences in a batch. Model interface - Tokens are integers. - mo...

Coding & Algorithms
44
0
323 people solved
Sep 22, 2025
Meta logo
Meta
Medium
Machine Learning Engineer

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

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

Find kth smallest in sorted matrix

Given an n x n matrix where each row and each column is sorted in nondecreasing order, and an integer k (1 ≤ k ≤ n^ 2), return the k-th smallest eleme...

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

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

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

Maximize ones with limited flips

Given a binary array and an integer k, return the length of the longest contiguous subarray achievable by flipping at most k zeros to ones. Explain an...

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

Search a word in a grid

Given a 2D grid of characters and a target word, determine if the word can be traced by moving up, down, left, or right, using each cell at most once....

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

Implement automatic braking logic in Python

Using Python, implement a simple automatic braking function. Given current speed v (m/s), distance to obstacle d (m), maximum deceleration a_max (m/s^...

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

Design O(1) random-sampling set

Design a data structure that supports insert(x), remove(x), and get_random() that returns a uniformly random element among the present items, all in e...

Coding & Algorithms
18
0
143 people solved
Sep 6, 2025
Samsung logo
Samsung
Medium
Machine Learning Engineer

Validate palindrome with constraints

Given a string s, return true if s reads the same forward and backward after removing all non-alphanumeric characters and ignoring letter case. Implem...

Coding & Algorithms
4
0
33 people solved
Sep 6, 2025
Two Sigma logo
Two Sigma
Medium
Machine Learning Engineer

Solve tree partition and IPO allocation

1) Tree partitioning for minimum difference: Given a rooted tree as an array parent of length n (parent[i] gives the parent of node i, and parent[root...

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

Implement binary search lower/upper bounds

Question Given a non-decreasing sorted integer array nums of length n and a target value, implement two functions using binary search: 1. lower_bound(...

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

Find kth smallest pair sum with heaps

You are given two nondecreasing arrays A (length n) and B (length m) of non-negative integers and an integer k (1 <= k <= n*m). Return the k-th smalle...

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

Find connected region sizes in matrix

Given an m x n grid of characters grid and a target character ch, implement: ( 1) sizeOfRegion(grid, r0, c0, ch) -> int that returns the size of the 4...

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

Optimize ribbon piece length by binary search

Given an array lengths of positive integers and an integer k, you may cut each element into pieces of integer length L > 0. Find the maximum L such th...

Coding & Algorithms
3
0
48 people solved
Sep 6, 2025
Capital One logo
Capital One
Medium
Machine Learning Engineer

Rotate matrix and find max lamp coverage

1) Square-matrix rotation with extra space: Given an n x n integer matrix, return a new matrix that is the 90-degree clockwise rotation of the input. ...

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

Find earliest supporting version under constraints

You are given version strings formatted as {major}.{minor}.{patch}, e.g., "103.003.03". Each version either supports a feature or not. You may call is...

Coding & Algorithms
29
0
472 people solved
Sep 6, 2025
Meta logo
Meta
Medium
Machine Learning EngineerIntern

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

Coding & Algorithms
3
0
44 people solved
Sep 2, 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