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."
Compute CDF from a PDF Function
You are given a callable function pdf(t) that returns the probability density of a normal distribution at value t. Implement a function cdf(x) that re...
Compute Jaccard Similarity for Lists
Implement a Python function to compute the Jaccard similarity between two lists of strings. `python def jaccard_similarity(a: list[str], b: list[str])...
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...
Find the Next Larger Palindrome
Given a positive integer n, return the smallest integer strictly greater than n whose decimal representation is a palindrome. A palindrome reads the s...
Implement Stratified Sampling by Country
You are given a large in-memory Python list named records, where each element is a dictionary with at least the following keys: - country: str - devic...
Implement Buffer Parsers and Generic Map Class
In C++, complete the following two independent implementation tasks. 1. Sequential buffer reader You are given a raw byte buffer and a current poin...
Implement Integer Square Root
Given a non-negative integer x, implement sqrt(x) and return the integer part of its square root, i.e., floor(sqrt(x)). Requirements: - Do not use a b...
Sort a Nearly Sorted Array
Given an array nums of length n in which every element is at most k positions away from its location in the fully sorted order, return the array in so...
Implement Safe Average Function
Write a Python function average(values) that returns the arithmetic mean of a list of numbers. Requirements: - If values is empty, return 0. - The inp...
Implement Jackknife and Random Choice
Write Python code for two implementation tasks without using np.random.choice directly: 1. Jackknife-style resampling. Given a one-dimensional collect...
Implement FizzBuzz
Implement the classic FizzBuzz problem. Given a positive integer n, return the sequence from 1 to n as strings with the following rules: - If a number...
Traverse an Org Chart by Level
You are given an organization's reporting structure as a flat list of employee-manager relationships. Exactly one employee is the root (the CEO) and h...
Evaluate Piecewise Linear Function
Given a list of 2D points [(x1, y1), (x2, y2), ..., (xn, yn)], where the points are ordered by strictly increasing x, connect each consecutive pair of...
Implement KNN from Scratch
Implement a k-nearest neighbors (KNN) classifier from scratch in Python without using scikit-learn's KNN implementation. Given training features X_tra...
Implement stacks, streaming median, and upward path sum
Complete the following coding problems. State the time/space complexity and key edge cases for each. 1) MinStack Design a stack that supports: - push(...
Determine earliest collision among moving cars
You are given n cars moving over time. Each car has known initial state at time \(t=0\): - 1D case (straight road): - initial position \(x_i\) (mete...
Implement composition and mixin utilities
Solve the following two Python tasks. Part A: Implement function composition Implement a Python function compose(*funcs) that: 1. Accepts any number o...
Compute variance of a list in Python
Task Given a Python list of numbers (ints/floats), write code to compute its variance. Requirements - Input: nums: list[float] (length \(n\ge 1\)) - C...
Count closed islands in a grid
Problem You are given an m x n 2D grid representing a map after flooding: - 0 = water - 1 = land An island is a maximal 4-directionally connected comp...
Merge Two Sorted Lists
You are given the heads of two singly linked lists, each already sorted in non-decreasing order. Merge them into one sorted linked list and return the...