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.

"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."
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 ...
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...
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-...
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...
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...
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...
Explain list vs tuple in Python
This question evaluates understanding of Python sequence types, specifically differences in mutability, hashing ability, memory footprint, and iterati...
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...
Implement Stratified Sampling by Country
This question evaluates understanding of stratified sampling, proportional allocation across groups, reproducible random sampling, data grouping and e...
Implement KNN from Scratch
This question evaluates a candidate's understanding and practical implementation skills for instance-based supervised learning, specifically the k-nea...
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 ...
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...
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...
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 ...
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 ...
Implement KNN from scratch
Without using ML libraries, implement k-Nearest Neighbors for classification. Requirements: (a) Support Euclidean and cosine distances; (b) Allow tie-...
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...
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...
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...
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 ...