Data Scientist Coding & Algorithms Interview Questions
Practice 312 real Coding & Algorithms interview questions for Data Scientist roles. From companies including Amazon, Google, Pinterest, Uber, Capital One.

"I got asked a hardcore MCM DP question and I saw it on PracHub as well. Solved that question in 5 minutes. Without PracHub I doubt I could solve it in 5 hours. Though somehow didn't get hired, perhaps I guess I solved it too fast? /s"

"Believe me i'm a student here jn US. Recently interviewed for MSFT. They asked me exact question from PracHub. I saw it the night before and ignored it cause why waste time on random sites. I legit wanna go back and redo this whole thing if I had chance. Not saying will work for everyone but there is certainly some merit to that website. And i'm gonna use it in future prep from now on like lc tagged"

"10 years of experience but never worked at a top company. PracHub's senior-level questions helped me break into FAANG at 35. Age is just a number."

"I was skeptical about the 'real questions' claim, so I put it to the test. I searched for the exact question I got grilled on at my last Meta onsite... and it was right there. Word for word."

"Got a Google recruiter call on Monday, interview on Friday. Crammed PracHub for 4 days. Passed every round. This platform is a miracle worker."

"I've used LC, Glassdoor, and random Discords. Nothing comes close to the accuracy here. The questions are actually current — that's what got me. Felt like I had a cheat sheet during the interview."

"The solution quality is insane. It covers approach, edge cases, time complexity, follow-ups. Nothing else comes close."

"Legit the only resource you need. TC went from 180k -> 350k. Just memorize the top 50 for your target company and you're golden."

"PracHub Premium for one month cost me the price of two coffees a week. It landed me a $280K+ starting offer."

"Literally just signed a $600k offer. I only had 2 weeks to prep, so I focused entirely on the company-tagged lists here. If you're targeting L5+, don't overthink it."

"Coaches and bootcamp prep courses cost around $200-300 but PracHub Premium is actually less than a Netflix subscription. And it landed me a $178K offer."

"I honestly don't know how you guys gather so many real interview questions. It's almost scary. I walked into my Amazon loop and recognized 3 out of 4 problems from your database."

"Discovered PracHub 10 days before my interview. By day 5, I stopped being nervous. By interview day, I was actually excited to show what I knew."

"I recently cleared Uber interviews (strong hire in the design round) and all the questions were present in prachub."
"The search is what sold me. I typed in a really niche DP problem I got asked last year and it actually came up, full breakdown and everything. These guys are clearly updating it constantly."
Build referral chains and detect cycles
You are given a directed referral graph where each user may have at most one referrer. Input file 'referrals.csv' has columns: user_id (INT), referred...
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...
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 (...
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 ...
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 ...
Implement KNN from scratch
Without using ML libraries, implement k-Nearest Neighbors for classification. Requirements: (a) Support Euclidean and cosine distances; (b) Allow tie-...
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...
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...
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...
Implement streaming SRM detector with late events
Implement a streaming detector for sample ratio mismatch (SRM) across many concurrent experiments. Input is two topic-partitioned streams: assignments...
Implement piecewise linear interpolation for time-to-empty
Time-to-Empty from a Discharge Curve (Piecewise Linear Interpolation) Implement a function time_to_empty(checkpoints, current_soc) that returns the nu...
Implement sliding-window device anomaly
Streaming detection algorithm: Implement a function process_logins(stream) that consumes a time-ordered stream of login events (user_id, ts, device_id...
Implement Director awards with Python OOP
Python OOP Exercise: Director extends Cast Context You are working with a simple class hierarchy where Director extends Cast. Implement a robust, test...
Count subarrays equal to target
Given an integer array nums and an integer k, count the number of contiguous subarrays whose sum equals k. Solve it in O(n) time and O(n) space by mai...
Solve Logic Puzzles: Algorithms and Proofs Required
Scenario On-site logic/algorithm quiz with hiring manager and VP Question Solve six AMC-8–level math/logic puzzles, including the classic farmer-fox-c...
Generate Bigrams Using Python List Comprehension and Zip
Scenario Live Python exercise: generate all bigrams from an input string and iteratively optimize the solution. Question Write a Python function that ...
Solve Algorithmic Challenges in Online Coding Assessments
Scenario Online assessment requiring implementation of common algorithmic problems. Question Given an array of integers and a target, return indices o...
Explain coding solution and alternatives
Explain the logic behind your solution to a previous coding problem (e.g., the second coding task in this interview). Walk through your approach step ...
Compute maximum score using up to 3 categories
Problem A library runs a summer reading program. Each book a student reads earns a certain number of points, and each book belongs to a category. A st...
Count super-streak segments in an event stream
Problem You are given a time-ordered sequence of events. Each event has: - type (string or int) - ts (timestamp as integer milliseconds/seconds) A str...