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
Squarepoint logo
Squarepoint
Medium
Data Scientist

Maximize revenue from inventory sales

Problem A store has n different products. For each product i (0-indexed), you are given an integer quantity[i] representing how many units of that pro...

Coding & Algorithms
6
0
64 people solved
Dec 8, 2025
Airwallex logo
Airwallex
Medium
Data ScientistSenior+ Locked

Implement bootstrap mean and variance

This question evaluates a candidate's ability to implement bootstrap resampling and compute statistical estimates for the sampling distribution of the...

Coding & Algorithms
4
0
65 people solved
Dec 8, 2025
Two Sigma logo
Two Sigma
Hard
Data Scientist

Expected Number of Good Pairs in a Randomly Weighted Complete Graph

Expected Number of Good Pairs in a Randomly Weighted Complete Graph You are given a complete graph on n vertices — every pair of distinct vertices is ...

Coding & Algorithms
0
0
8 people solved
Dec 2, 2025
Two Sigma logo
Two Sigma
Hard
Data Scientist

Smallest Palindrome Strictly Greater Than K

A palindrome is a positive integer whose decimal representation reads the same forwards and backwards, with no leading zeros. For example, 7, 44, 121,...

Coding & Algorithms
0
0
7 people solved
Nov 28, 2025
Hudson logo
Hudson
Medium
Data Scientist

Count inversions in a permutation

Problem Given an array a of length n that is a permutation of distinct integers (e.g., 1..n), define an inversion as a pair of indices (i, j) such tha...

Coding & Algorithms
9
0
69 people solved
Nov 28, 2025
Google logo
Google
Medium
Data ScientistSenior+

Simulate Uniform(0,1) from random bits

Assume you have access to a function rand_bit() that returns 0 or 1 with equal probability and independent across calls. How would you generate a rand...

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

Compute probability last passenger gets own seat

There are 100 passengers boarding a plane with 100 seats, numbered 1 to 100. Passenger i (for 1 ≤ i ≤ 100) has a ticket for seat i. The boarding proce...

Coding & Algorithms
2
0
40 people solved
Nov 1, 2025
Airwallex logo
Airwallex
Medium
Data ScientistSenior+ Locked

Implement bootstrap mean and variance

This question evaluates the ability to implement bootstrap resampling and compute descriptive statistics, testing competency in statistical estimation...

Coding & Algorithms
3
0
32 people solved
Oct 24, 2025
Point72 logo
Point72
Easy
Data ScientistIntern

Find kth missing integer and redundant operations

You are given two independent coding tasks. Task 1: K-th missing number You are given an integer array nums (not necessarily sorted) containing distin...

Coding & Algorithms
7
0
55 people solved
Oct 20, 2025
Tradedesk logo
Tradedesk
Easy
Data Scientist

Implement monotonic-array linear interpolation

Question Implement a function interpolate(array_x, array_y, x) that returns the linearly interpolated y-value for a query x-value, given paired data p...

Coding & Algorithms
2
0
57 people solved
Oct 18, 2025
Roblox logo
Roblox
Easy
Data ScientistIntern

Implement four DS coding tasks

You are completing a CodeSignal-style assessment (Python or R). Implement solutions for the following four independent questions. 1) Two-sample z-test...

Coding & Algorithms
11
0
227 people solved
Oct 18, 2025
Apple logo
Apple
Medium
Data Scientist

Remove shortest subarray to sort array

Given an integer array nums (length up to 2×10^5), return the shortest subarray [L,R] you can remove so that the remaining elements form a non‑decreas...

Coding & Algorithms
5
0
65 people solved
Oct 13, 2025
Capital One logo
Capital One
Medium
Data Scientist

Optimize invites under capacity constraints

You have n donors (n up to 100,000). For each donor i you know: p_online[i] (probability of donating if emailed), a_online[i] (expected donation condi...

Coding & Algorithms
11
0
93 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Compute precision–recall curve on imbalanced data

You receive a CSV with columns: actual_label ∈ {0,1} and predicted_prob ∈ [0,1]; the positive class rate is ≈5%. a) Which evaluation metrics would you...

Coding & Algorithms
10
0
82 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Minimize L2, L1, and quantile losses

Given an array X of n real numbers, derive the value θ that minimizes the sum of squared deviations Σ(xi−θ)² (mean) and the sum of absolute deviations...

Coding & Algorithms
7
0
64 people solved
Oct 13, 2025
Apple logo
Apple
Medium
Data Scientist

Find longest uniform substring after k replacements

Given a string s (ASCII, length up to 2e5) and integer k (0 ≤ k ≤ |s|), return the length of the longest substring that can be turned into all the sam...

Coding & Algorithms
4
0
47 people solved
Oct 13, 2025
TikTok logo
TikTok
Medium
Data Scientist

Maximize products bought under budget

Given N products and M customers, for each customer find the list of distinct products they can buy without exceeding their budget such that the numbe...

Coding & Algorithms
3
0
45 people solved
Oct 13, 2025
Citadel logo
Citadel
Medium
Data Scientist

Implement lazy unique-merge generator for sorted streams

Write a Python generator merge_unique(a, b) that lazily merges two nondecreasing iterables a and b (potentially infinite) into a single nondecreasing ...

Coding & Algorithms
10
0
92 people solved
Oct 13, 2025
Amazon logo
Amazon
Medium
Data Scientist

Compute array modes with ties and no-mode rule

Write a function that returns the mode(s) of an integer array. Requirements: if all values are unique, return an empty list (there is no mode); allow ...

Coding & Algorithms
3
0
32 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Implement anagram check and stable deduplication

Part A — Anagram checker: Write a function is_anagram(a: str, b: str, locale: str = 'en') -> bool that returns True iff a and b are anagrams under the...

Coding & Algorithms
4
0
49 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