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."
Maximize watched duration under consecutive-sum limit
You have a list of videos in a feed. Video i has duration d[i] (positive integer). A user has an “attention span” limit A. You want to select a subset...
Find maximum follow depth using recursion
You are given a directed follows relationship representing a social graph: - Each record (follower_id, followee_id) means follower_id follows followee...
Implement several OA simulation problems
Reconstruct and solve the following coding problems from an online assessment. 1. Case-insensitive adjacent differences Given a string s, treat u...
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...
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 stack variants and upward path sum
Question Answer the following coding questions. They progress from augmented stacks to streaming statistics to tree path reasoning. 1. MinStack — Desi...
Return all combinations that sum to target
Given an array of distinct positive integers candidates and an integer target, return all unique combinations of candidates where the chosen numbers s...
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 Connect Four Winner Detection
Implement a Connect Four-style game engine. The board has 6 rows and 7 columns. Two players alternate turns. On each turn, the current player chooses ...
Implement merge sort and largest 1-rectangle
The coding round included two algorithm questions: 1. Implement merge sort for an array of integers. Return the sorted array and explain its time and ...
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...
Compute and plot a precision–recall curve
You are given model outputs for a binary classifier: - y_true: an array of 0/1 ground-truth labels of length n. - y_score: an array of predicted score...
Choose fastest way to transfer 2 TB
You need to transfer a 2 TB dataset to someone located in San Francisco as fast as possible. - What transfer method(s) would you choose and why? - St...
Return the largest file size in a directory
Problem (Bash / File System) Implement a Bash function (or shell snippet) that returns the maximum file size (in bytes) under a given directory. Requi...
Count inversions in a permutation
Problem Given an array a of length n that is a permutation of distinct integers (e.g., 1..n), define an inversion as a pair of indices (i, j) such tha...
Implement rotated array binary search with duplicates
Given an integer array nums that is a non-decreasing array rotated an unknown number of times. Duplicates may exist. Implement a function that returns...
Move zeros to the front
You are given an integer array nums. Reorder the array in place so that all 0 values are moved to the beginning of the array, while preserving the rel...
Maximize revenue from inventory sales
Problem A store has n different products. For each product i (0-indexed), you are given an integer quantity[i] representing how many units of that pro...
Compare two programs for equivalence
You are given two short programs (or functions) that process an integer array A (|A| ≤ 10^ 5). Determine whether they are functionally equivalent for ...
Infer and justify non-trivial sequence patterns
Pattern Recognition: Next Terms and Missing Value Identify the rule governing each sequence or row and compute the missing value(s). Justify each answ...