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

Detect sequence rule and repair anomaly

Implement next_value(seq: list[int]) that detects the rule of a numeric sequence and returns a tuple (model_name, parameters, anomaly_index_or_None, n...

Coding & Algorithms
3
0
62 people solved
Oct 13, 2025
Atlassian logo
Atlassian
Medium
Data Scientist

Implement sliding-window rate limiter with dual thresholds

Implement getRequestStatus(urls: List[str]) -> List[str]. The i-th entry in urls represents a single incoming request at timestamp t = i seconds (t st...

Coding & Algorithms
7
0
56 people solved
Oct 13, 2025
Amazon logo
Amazon
Medium
Data ScientistSenior+

Implement streaming k-way merge with constraints

Implement a function merge_k(iterators, N) that returns the first N items of the global ascending order from k sorted, potentially unbounded iterators...

Coding & Algorithms
6
0
86 people solved
Oct 13, 2025
Thumbtack logo
Thumbtack
Medium
Data Scientist

Implement min, mean, median robustly

Implement three functions in Python without using numpy/pandas: (1) my_min(nums) returning the minimum in O(n) time and O(1) space; (2) my_mean(nums) ...

Coding & Algorithms
4
0
41 people solved
Oct 13, 2025
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
49 people solved
Oct 13, 2025
Capital One logo
Capital One
Medium
Data Scientist

Debug and test a Python function in venv

Consider the Python snippet below. """ import math def accumulate(nums, start=0, cache={}): total = start for n in nums: if n % 2 == 0: nums.appen...

Coding & Algorithms
7
0
100 people solved
Oct 13, 2025
Pinterest logo
Pinterest
Medium
Data Scientist

Implement and extend My Calendar III

Design and implement a booking system like LeetCode 732 (My Calendar III). Provide a class with methods: book(start, end) using half-open intervals [s...

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

Implement weighted sampling without replacement

Implement in Python a function sample_k(items, weights, k) that returns k items without replacement with probability proportional to weight. Requireme...

Coding & Algorithms
8
0
121 people solved
Oct 13, 2025
Pinterest logo
Pinterest
Medium
Data Scientist

Find list pair with maximum overlap

You are given N labeled lists of items as a Python dict mapping list_name -> iterable of strings. Example input: {'L1': ['A','B','C'], 'L2': ['A','C',...

Coding & Algorithms
5
0
90 people solved
Oct 13, 2025
Meta logo
Meta
Medium
Data Scientist

Implement randomized Quickselect without k-shift bug

Implement randomized Quickselect to return the k-th largest element (1-based k, 1 ≤ k ≤ n) from an unsorted integer array. Use an in-place partition t...

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

Compute binary-tree diameter via return-only DFS

Given the root of a binary tree, compute its diameter defined as the number of edges on the longest path between any two nodes. Implement a DFS that r...

Coding & Algorithms
6
0
45 people solved
Oct 13, 2025
Meta logo
Meta
Medium
Data Scientist

Compute 95th-percentile call concurrency

Given N call sessions as half-open intervals [start, end) in UNIX seconds, design an algorithm to compute the 95th percentile of per-minute concurrent...

Coding & Algorithms
3
0
39 people solved
Oct 13, 2025
Amazon logo
Amazon
Hard
Data Scientist

Solve subset-count and kth-factor problems

Two Independent Tasks A) Maximum Count Under Sum Constraint You are given an integer array arr and an integer budget n. Return the maximum number of e...

Coding & Algorithms
4
0
58 people solved
Oct 13, 2025
Uber logo
Uber
Hard
Data Scientist

Implement sqrt with Newton vs binary search

Implement numerically robust square-root routines and analyze convergence Task 1 — sqrt_newton(x, tol=1e-12) Implement a Python function that returns ...

Coding & Algorithms
7
0
138 people solved
Oct 13, 2025
LinkedIn logo
LinkedIn
Medium
Data Scientist

Implement fast sampling for weighted k-sided die

You must sample from a categorical distribution over k outcomes with probabilities p1..pk (sum to 1) without using built-in categorical samplers. You ...

Coding & Algorithms
4
0
89 people solved
Oct 13, 2025
Yelp logo
Yelp
Medium
Data Scientist

Compute and Rank by Jaccard Similarity

Implement two functions: (1) jaccard_similarity(s1, s2) that tokenizes by splitting on any non-alphanumeric character, lowercases, treats tokens as se...

Coding & Algorithms
3
0
44 people solved
Oct 13, 2025
Freddie Mac logo
Freddie Mac
Medium
Data Scientist

Implement blocked time-series cross-validation

Implement a panel-aware blocked time-series cross-validation splitter with an embargo. Input: DataFrame columns [loan_id, msa, month]. Requirements: (...

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

Refactor code and enforce robustness

Code Review and Refactor: Summing a CSV Column Context You are reviewing a short Python script that sums a numeric column from a CSV using pandas. You...

Coding & Algorithms
6
0
108 people solved
Oct 13, 2025
Amazon logo
Amazon
Medium
Data ScientistSenior+

Implement list overlap and dense-ranked word frequencies

Part A — Multiset overlap count Implement count_overlap(a: List[int], b: List[int]) -> int that returns the size of the multiset intersection of a and...

Coding & Algorithms
4
0
38 people solved
Oct 13, 2025
Uber logo
Uber
Medium
Data Scientist

Compute maximum concurrent trips from intervals

You’re given n trip intervals [start, end) in seconds, where start < end, representing when a rider’s trip starts and ends in a city on a specific day...

Coding & Algorithms
16
0
164 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