Data Scientist Coding & Algorithms Interview Questions

Practice 335 real Coding & Algorithms interview questions for Data Scientist roles. From companies including Amazon, Google, Two Sigma, Pinterest, Uber.

335 Questions 80 Companies08.08.2026
Showing 20 results
Role
Two Sigma logo
Two Sigma
Hard
Data ScientistIntern

Maximum-Product Simple Path in a Complete Directed Graph

You are given a complete directed graph with n nodes labeled 0 through n - 1. For every ordered pair of distinct nodes (i, j), there is a directed edg...

Coding & Algorithms
0
0
5 people solved
Nov 15, 2025
Two Sigma logo
Two Sigma
Hard
Data ScientistIntern

Count Distinct Island Shapes in a Binary Grid

You are given an m x n binary grid grid, where grid[i][j] is either 0 (water) or 1 (land). An island is a maximal group of 1-cells connected 4-directi...

Coding & Algorithms
0
0
7 people solved
Nov 15, 2025
Squarepoint logo
Squarepoint
Hard
Data Scientist

Maximize profit from one or many stock trades

You are given an integer array prices where prices[i] is the price of a stock on day i (0-indexed). Answer the following two subproblems: 1. Single tr...

Coding & Algorithms
2
0
37 people solved
Nov 7, 2025
Schonfeld logo
Schonfeld
Medium
Data Scientist

Find smallest N for 5-and-21 sums

You are given two positive integers: 5 and 21. We say a positive integer x is representable if it can be written in the form \[ x = 5a + 21b \] for so...

Coding & Algorithms
2
0
26 people solved
Nov 1, 2025
Google logo
Google
Easy
Data Scientist

Match payments to invoices by memo or amount

Scenario You are building a small reconciliation tool that matches payments to invoices. Data structures Assume you are given: - invoices: a list of i...

Coding & Algorithms
8
0
57 people solved
Oct 25, 2025
Morgan Stanley logo
Morgan Stanley
Easy
Data Scientist

Compute win probability in coin-toss game

Two players, A and B, play the following game with a fair coin: - They toss the coin alternately: A tosses first, then B, then A, then B, and so on. -...

Coding & Algorithms
2
0
45 people solved
Oct 21, 2025
Google logo
Google
Medium
Data Scientist

Match payments to invoices by memo or amount

You are building a small payment-to-invoice matching utility. Data You are given: - invoices: a list of invoice records with: - invoice_id (string) ...

Coding & Algorithms
5
0
51 people solved
Oct 19, 2025
Databricks logo
Databricks
Hard
Data ScientistIntern

Find top-5 most similar rows across datasets

You are given two datasets with the same feature columns: - source (rows you want to match): - source_id (STRING/INT) - f1...fk (NUMERIC; may cont...

Coding & Algorithms
2
0
45 people solved
Oct 14, 2025
Capital One logo
Capital One
Medium
Data Scientist

Implement minimal-cost overtime/contractor allocation

You must cover H extra engineering hours this week at minimum cost using employee overtime and optional contractors. Each employee i has a maximum ove...

Coding & Algorithms
7
0
51 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Implement percentage RMSE and bootstrap its CI

Given a CSV with columns [country, actual_revenue, predicted_revenue], define percentage RMSE as pRMSE = sqrt(mean_i((pred_i/actual_i − 1)^2)). a) Imp...

Coding & Algorithms
6
0
49 people solved
Oct 13, 2025
Amazon logo
Amazon
Medium
Data Scientist

Solve two-sum variants at scale

Base task: Given nums = [3, 1, 2, 2, 4] and target = 4, return the 0-based index pair (i, j) with i < j such that nums[i] + nums[j] = target. If multi...

Coding & Algorithms
9
0
69 people solved
Oct 13, 2025
OneMain Financial logo
OneMain Financial
Medium
Data Scientist

Implement an LRU cache with O(1) ops

Design and code an LRU cache supporting get(key) and put(key, value) in O(1) average time with capacity N. Specify your data structures, handle update...

Coding & Algorithms
5
0
42 people solved
Oct 13, 2025
Point72 logo
Point72
Medium
Data Scientist

Classify relationships for multiple circle pairs

Given an array pairs of N circle pairs, where each circle is (x, y, r) with integer coordinates and r ≥ 0, classify each pair into one of: IDENTICAL (...

Coding & Algorithms
6
0
61 people solved
Oct 13, 2025
Point72 logo
Point72
Medium
Data Scientist

Maximize outfits with distinct colors

You're given counts of items by color; each outfit must contain exactly 3 items, all of distinct colors. You cannot reuse items. Input formats: either...

Coding & Algorithms
4
0
57 people solved
Oct 13, 2025
Netflix logo
Netflix
Medium
Data Scientist

Implement longest increasing subarray with one deletion

Given an array of integers nums, return the length of the longest strictly increasing contiguous subarray you can obtain by deleting at most one eleme...

Coding & Algorithms
18
0
129 people solved
Oct 13, 2025
Citadel logo
Citadel
Medium
Data Scientist

Implement max profit with K transactions (DP)

Given an array prices[0..n-1] of daily stock prices and an integer k, implement a bottom-up dynamic program to compute the maximum achievable profit w...

Coding & Algorithms
3
0
31 people solved
Oct 13, 2025
Etsy logo
Etsy
Medium
Data Scientist

Implement streaming autocomplete under tight memory

Build an autocomplete service: Input: a list of up to 5,000,000 UTF-8 words (may include accents and hyphens), each with an integer popularity score t...

Coding & Algorithms
5
0
50 people solved
Oct 13, 2025
Amazon logo
Amazon
Medium
Data Scientist

Generate primes up to n efficiently

Implement a function that returns all prime numbers in the inclusive range 1..n. Requirements: handle n up to 10^7 efficiently (time and memory); retu...

Coding & Algorithms
5
0
36 people solved
Oct 13, 2025
Medium
Data Scientist

Implement multiplication without using the multiplication operator

Implement int multiply(int a, int b) without using * or /. You may use +, −, bitwise operators, and shifts. Requirements: - Handle negatives, zero, an...

Coding & Algorithms
2
0
37 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Implement longest subarray summing to k

Given an integer array nums (length ≤ 200,000; values may be negative) and integer k, return the maximum length and the [l, r] indices of a contiguous...

Coding & Algorithms
8
0
68 people solved
Oct 13, 2025

Explore more Data Scientist Coding & Algorithms interview questions

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

By company
Other categories for Data Scientist
Coding & Algorithms questions for other roles
Browse all