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."
Decompress an encoded string
Given an encoded string, return its decoded (decompressed) form. Use the following encoding rule: - A positive integer \(k\) followed by a bracketed s...
Simulate Uniform(0,1) from random bits
Assume you have access to a function rand_bit() that returns 0 or 1 with equal probability and independent across calls. How would you generate a rand...
Implement sampling and subarray algorithms
This coding round contained two algorithmic prompts: 1. Uniform sampling in a 2D square You are given access to a function rand01() that returns ...
Implement sampling and subarray scan
A coding interview included the following algorithm questions: 1. You are given access to a function rand01() that returns an independent sample from ...
Implement sampling, subarray scan, and percentile estimate
You will solve three independent coding tasks. Problem 1: Generate a 2D uniform sample in a square You are given access to a function rand01() that re...
Find Longest Increasing Continuous Subarray
Given an integer array nums, return the length of the longest contiguous strictly increasing subarray. Here, "continuous" means the elements must appe...
Solve Search Insert Position Using Binary Search
Scenario Live coding round for an Amazon Applied Scientist position; candidate must solve LeetCode 35 (Search Insert Position) without helper librarie...
Remove shortest subarray to sort array
Given an integer array nums (length up to 2×10^5), return the shortest subarray [L,R] you can remove so that the remaining elements form a non‑decreas...
Implement percentage RMSE and bootstrap its CI
Given a CSV with columns [country, actual_revenue, predicted_revenue], define percentage RMSE as pRMSE = sqrt(mean_i((pred_i/actual_i − 1)^2)). a) Imp...
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...
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...
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...
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 ...
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...
Match a string with wildcard pattern recursively
Implement a function that checks whether an input string matches a wildcard pattern. Pattern rules - ? matches exactly one character. - * matches any ...
Design Algorithm to Minimize Payments in Expense-Sharing App
Scenario Expense-sharing app needs to settle debts among friends after a trip. Question Given a list of transactions (payer, payee, amount), design an...
Implement DelayQueue with Idempotent Task Execution
Scenario Message broker offers DelayQueue where tasks execute at future timestamps, ensuring idempotency on duplicate IDs. Question Implement a delay ...
Determine Pin Connections Through Common Boards
Scenario Pinterest boards contain many pins; need to infer relationships between pins. Question Given the membership lists of all boards, write a func...
Solve matrix add, frequency count, longest consecutive
You are asked to solve the following 3 coding tasks (in any language). Implement each as a function. 1) Add two matrices Input: Two 2D integer arrays ...
Implement factorial and count trailing zeros
Answer the following coding questions in Python. 1) Implement factorial Implement a function factorial(n) that returns \(n!\) for a non-negative integ...