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."
Implement an LRU Cache
Problem: LRU Cache (LeetCode 146) Design and implement a Least Recently Used (LRU) Cache that supports the following operations in average O(1) time. ...
Implement Fibonacci with efficiency constraints
Write a function fib(n) that returns the nth Fibonacci number (0-indexed: fib(0)=0, fib(1)=1). Requirements: - Handle n up to at least 10^6. - Discuss...
How do you expand nested placeholders in strings?
You are given a dictionary of string templates. Keys are identifiers like X, Y, Z. A template may contain placeholders of the form %KEY%, which should...
Solve Data-Structure Problems in Python Interview Round
Scenario Interview coding round focusing on simple data-structure problems in Python. Question Given an integer, rearrange its digits (considering onl...
Validate Unit-Test Coverage and Identify Missing Scenarios
Scenario Tech round: reviewing an existing unit-test that exercises the class from Part 2 Question i) What does the current unit-test validate? ii) Li...
Implement four DS coding tasks
You are completing a CodeSignal-style assessment (Python or R). Implement solutions for the following four independent questions. 1) Two-sample z-test...
Return sorted values after quadratic transform
Problem You are given a sorted integer array nums (non-decreasing order) and integers a, b, c that define a quadratic function: \[ f(x) = ax^2 + bx +...
Compute square root to 1 decimal
Problem Given a non-negative real number x, implement a function sqrt1dp(x) that returns \(\sqrt{x}\) rounded (or truncated—clarify with interviewer) ...
Implement minimal-cost overtime/contractor allocation
You must cover H extra engineering hours this week at minimum cost using employee overtime and optional contractors. Each employee i has a maximum ove...
Maximize outfits with distinct colors
You're given counts of items by color; each outfit must contain exactly 3 items, all of distinct colors. You cannot reuse items. Input formats: either...
Implement longest increasing subarray with one deletion
Given an array of integers nums, return the length of the longest strictly increasing contiguous subarray you can obtain by deleting at most one eleme...
Generate primes up to n efficiently
Implement a function that returns all prime numbers in the inclusive range 1..n. Requirements: handle n up to 10^7 efficiently (time and memory); retu...
Prove reservoir sampling correctness
Design an algorithm to sample k items uniformly at random from a stream of unknown and potentially massive length N, using O(k) memory and one pass. (...
Compute max island with constrained flips
Given an n×n binary grid G where 1=land and 0=water with 4-directional connectivity, return the size of the largest island achievable by flipping at m...
Compute binary-tree diameter via return-only DFS
Given the root of a binary tree, compute its diameter defined as the number of edges on the longest path between any two nodes. Implement a DFS that r...
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 FizzBuzz
Write a function that takes an integer n and outputs the numbers from 1 to n using the standard FizzBuzz rules: - output Fizz for numbers divisible by...
Devise sequence-rule detection strategy
You are given an integer sequence with 2 ≤ n ≤ 50 terms, possibly following rules such as arithmetic/geometric progressions, alternating patterns, pol...
Print Org Chart by Level
You are given an organizational chart as a list of employee records: (employee_id, manager_id, employee_name), where manager_id is null for the CEO. A...
Find minimum operations to make array sorted
Problem You are given an integer array a of length n. Define one operation as follows: 1. Remove the first element x = a[0]. 2. Append x to the end of...