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

Compute max island with constrained flips

Given an n×n binary grid G where 1=land and 0=water with 4-directional connectivity, return the size of the largest island achievable by flipping at m...

Coding & Algorithms
5
0
50 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
Amazon logo
Amazon
Medium
Data Scientist

Solve stock, BFS path, and merge intervals

Solve three coding problems; justify complexity and corner cases. A) Best Time to Buy/Sell Stock (one transaction): Given prices[0..n-1] (integers), r...

Coding & Algorithms
4
0
36 people solved
Oct 13, 2025
Snowflake logo
Snowflake
Medium
Data Scientist

Solve and optimize 3Sum and variants at scale

Implement a function that returns all unique triplets (i, j, k) of indices whose values sum to a target T, with strong performance and deduplication g...

Coding & Algorithms
5
0
54 people solved
Oct 13, 2025
Snowflake logo
Snowflake
Hard
Data Scientist

Implement DFS with cycle detection and topo order

Implement DFS (recursive and iterative) with topo sort, cycle detection, and timestamps You are given a directed graph G with N nodes labeled 1..N and...

Coding & Algorithms
10
0
84 people solved
Oct 13, 2025
Stripe logo
Stripe
Medium
Data Scientist

Implement streaming per-user reservoir sampling

Design and code (in Python) a streaming algorithm that ingests an unbounded event stream of tuples (user_id, event_time, event_type) and maintains, fo...

Coding & Algorithms
0
0
9 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Medium
Data Scientist

Solve two-pointer, sliding-window, and string tasks

Solve the following three coding tasks: 1) Two-pointer in-place de-duplication: Given a non-decreasing integer array nums and an integer k >= 1, modif...

Coding & Algorithms
6
0
46 people solved
Oct 13, 2025
Uber logo
Uber
Medium
Data Scientist

Check anagrams under real-world constraints

Given two strings s and t, determine whether they contain exactly the same multiset of characters (e.g., 'abc' and 'cab' → true; 'aab' and 'ab' → fals...

Coding & Algorithms
4
0
84 people solved
Oct 13, 2025
Pinterest logo
Pinterest
Medium
Data Scientist

Implement scalable prime generator

Write a function first_n_primes(n) that returns the first n prime numbers in ascending order. Constraints: - 1 ≤ n ≤ 100,000. - Aim for O(n log log n)...

Coding & Algorithms
4
0
53 people solved
Oct 13, 2025
Roblox logo
Roblox
Medium
Data Scientist

Implement streaming CTR with deduplication

Implement a Python function to compute streaming, per-campaign CTR over a sliding 24-hour window with click de-duplication and late-arriving events. R...

Coding & Algorithms
8
0
88 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Medium
Data Scientist

Implement rotated array binary search with duplicates

Given an integer array nums that is a non-decreasing array rotated an unknown number of times. Duplicates may exist. Implement a function that returns...

Coding & Algorithms
5
0
67 people solved
Oct 13, 2025
NVIDIA logo
NVIDIA
Hard
Data Scientist

Reverse a singly linked list robustly

Reverse a Singly Linked List In-Place Context: You are given the head of a standard singly linked list (each node has value and next). Implement and e...

Coding & Algorithms
4
0
48 people solved
Oct 13, 2025
Easy
Data Scientist

Check if a numeric string is divisible by 8

Question You are given a very large non-negative integer represented as a decimal string s (it may be too large to fit in standard 64-bit integer type...

Coding & Algorithms
5
0
38 people solved
Sep 28, 2025
Uber logo
Uber
Medium
Data Scientist

Compute square root to 1 decimal

Problem Given a non-negative real number x, implement a function sqrt1dp(x) that returns \(\sqrt{x}\) rounded (or truncated—clarify with interviewer) ...

Coding & Algorithms
15
0
109 people solved
Sep 16, 2025
Squarepoint Capital logo
Squarepoint Capital
Medium
Data Scientist

Implement drawdown, single-trade profit, coin change

Implement and analyze the following three problems: 1) Maximum drawdown of cumulative PnL: "What is the maximum drawdown of a cumulative PnL (profit a...

Coding & Algorithms
6
0
48 people solved
Sep 6, 2025
Bank of America logo
Bank of America
Medium
Data Scientist

Compute maximum beauty of a string

Given a string s, define the beauty of each letter a–z as a distinct integer between 1 and 26, case-insensitive. The beauty of a string is the sum ove...

Coding & Algorithms
2
0
43 people solved
Aug 11, 2025
Shopify logo
Shopify
Medium
Data Scientist

Implement an LRU Cache

Problem: LRU Cache (LeetCode 146) Design and implement a Least Recently Used (LRU) Cache that supports the following operations in average O(1) time. ...

Coding & Algorithms
18
0
133 people solved
Aug 10, 2025
DRW logo
DRW
Medium
Data Scientist

Compute rolling standard deviation in O(n)

Compute rolling standard deviation in O(n) Given an array of numbers and a window size k, compute the rolling standard deviation for every contiguous ...

Coding & Algorithms
6
0
74 people solved
Aug 9, 2025
Squarepoint Capital logo
Squarepoint Capital
Medium
Data Scientist

Compute drawdown, profit, and coin change

Question What is the maximum drawdown of a cumulative PnL (profit and loss) series, and when did it occur? Implement a function mdd(pnl) that returns ...

Coding & Algorithms
7
0
60 people solved
Aug 4, 2025
Shopify logo
Shopify
Medium
Data Scientist

Implement Cosine Similarity Function for String Vectors

Scenario Technical phone screen in Python; assess ability to implement similarity metric. Question Implement a Python function that computes the cosin...

Coding & Algorithms
9
0
103 people solved
Aug 4, 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