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

Implement decay simulation and trailing-zero counting

Implement the following in Python: 1) Radioactive decay simulation: Half-life is 1 day. Write a simulation function that takes: - input: integer m ...

Coding & Algorithms
7
0
63 people solved
Nov 29, 2025
Bytedance logo
Bytedance
Medium
Data Scientist

Compute Minimum Parentheses Additions

Given a string s consisting only of the characters '(' and ')', compute the minimum number of parentheses that must be inserted anywhere in the string...

Coding & Algorithms
2
0
37 people solved
Apr 19, 2026
Robinhood logo
Robinhood
Medium
Data Scientist

Identify Overlapping Sessions and Optimize Coverage

Identify Overlapping Sessions and Optimize Coverage Scenario During the technical screen, candidates must implement interval algorithms used in fraud-...

Coding & Algorithms
12
0
112 people solved
Aug 4, 2025
Capital One logo
Capital One
Hard
Data Scientist

Find lexicographically smallest string and elimination order

You remember two coding questions from an online assessment. Question 1: Return the lexicographically smallest string after a prefix/suffix reverse Yo...

Coding & Algorithms
10
0
77 people solved
Sep 25, 2025
J.P. Morgan logo
J.P. Morgan
Medium
Data Scientist Locked

Solve tiling, probability, and nested-radical puzzles

This multi-part question evaluates combinatorics and algorithmic skills through 2×N and 3×N domino tiling problems, analysis of an infinite nested squ...

Coding & Algorithms
4
0
38 people solved
Jan 22, 2026
Two Sigma logo
Two Sigma
Medium
Data Scientist Locked

Maximize profit from one stock trade

This question evaluates algorithmic problem-solving skills with emphasis on array processing, numeric optimization, and time/space complexity analysis...

Coding & Algorithms
7
1
113 people solved
Jan 22, 2026
PayPal logo
PayPal
Easy
Data Scientist Locked

Explain list vs tuple in Python

This question evaluates understanding of Python sequence types, specifically differences in mutability, hashing ability, memory footprint, and iterati...

Coding & Algorithms
9
0
78 people solved
Jan 17, 2026
Microsoft logo
Microsoft
Medium
Data Scientist Locked

Print Org Chart by Level

This question evaluates the ability to model hierarchical data, work with tree/graph data structures, select traversal strategies, and analyze time an...

Coding & Algorithms
3
0
37 people solved
Jan 16, 2026
Perplexity logo
Perplexity
Medium
Data Scientist Locked

Implement Stratified Sampling by Country

This question evaluates understanding of stratified sampling, proportional allocation across groups, reproducible random sampling, data grouping and e...

Coding & Algorithms
3
0
49 people solved
Apr 9, 2026
J.P. Morgan logo
J.P. Morgan
Medium
Data ScientistNew Grad Locked

Implement KNN from Scratch

This question evaluates a candidate's understanding and practical implementation skills for instance-based supervised learning, specifically the k-nea...

Coding & Algorithms
2
0
24 people solved
Apr 7, 2026
Zest logo
Zest
Hard
Data Scientist

Compute tree depth and meeting rooms

Solve both coding problems. Problem 1: Maximum depth of a binary tree Given the root of a binary tree, return its maximum depth. The maximum depth is ...

Coding & Algorithms
1
0
23 people solved
Apr 5, 2026
Hudson logo
Hudson
Medium
Data Scientist Locked

Implement Buffer Parsers and Generic Map Class

This question evaluates proficiency in low-level C++ buffer parsing, memory and pointer management, safe binary deserialization, and template-based ge...

Coding & Algorithms
2
0
41 people solved
Apr 2, 2026
Meta logo
Meta
Medium
Data Scientist

Identify trees, lists, and array search costs

Answer all parts concisely and justify time complexities. a) A data model requires each node to have at most two children and a single parent. Name th...

Coding & Algorithms
6
0
56 people solved
Oct 13, 2025
Gemini logo
Gemini
Medium
Data Scientist

Detect k events in a sliding window

Implement an algorithm that, for each user, determines whether there exists a set of at least k ACH credit events from distinct device_ids within any ...

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

Write mini-batch gradient descent

Implement a generic mini-batch gradient descent routine: inputs are differentiable loss L(θ; x), initial θ0, batch size b, steps T, and learning-rate ...

Coding & Algorithms
4
0
42 people solved
Oct 13, 2025
Medium
Data Scientist

Implement KNN from scratch

Without using ML libraries, implement k-Nearest Neighbors for classification. Requirements: (a) Support Euclidean and cosine distances; (b) Allow tie-...

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

Review checkout code for defects and privacy

You are reviewing a supermarket checkout implementation. Identify and prioritize issues and fixes across: (a) monetary correctness (avoid floating poi...

Coding & Algorithms
4
0
70 people solved
Oct 13, 2025
Point72 logo
Point72
Hard
Data Scientist

Solve date, shopping, and circle problems

Take‑Home: Three Independent Tasks (Data/Algorithms) Implement three independent functions that will be unit‑tested separately. Provide clear error ha...

Coding & Algorithms
4
0
73 people solved
Oct 13, 2025
Yahoo logo
Yahoo
Medium
Data Scientist

Merge words by head-tail chaining

Given a list of lowercase words, merge them into a single string by repeatedly chaining words where the last character of the current string equals th...

Coding & Algorithms
5
0
44 people solved
Oct 13, 2025
Akuna Capital logo
Akuna Capital
Hard
Data Scientist

Find minimum swaps to sort array with duplicates

Problem Given an integer array nums of length n that may contain duplicate values, you may perform swaps where you choose any two indices i and j and ...

Coding & Algorithms
7
0
143 people solved
Dec 27, 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