Google Data Scientist Coding & Algorithms Interview Questions
Practice 22 real Coding & Algorithms interview questions for Data Scientist roles at Google.

"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."
Build a Next-Word Predictor
Implement a simple next-word model over tokenized training sentences. You need to write two functions: 1. train(sentences): receives a list of tokeniz...
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...
Build next-word predictor with O(1) lookup
Problem You are given a training corpus where each training example is a tokenized sentence (array of words). Example training sentences: - ["I", "am"...
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...
Match payments to invoices by memo or amount
Scenario You are building a small reconciliation tool that matches payments to invoices. Data structures Assume you are given: - invoices: a list of i...
Compute precision–recall curve on imbalanced data
You receive a CSV with columns: actual_label ∈ {0,1} and predicted_prob ∈ [0,1]; the positive class rate is ≈5%. a) Which evaluation metrics would you...
Minimize L2, L1, and quantile losses
Given an array X of n real numbers, derive the value θ that minimizes the sum of squared deviations Σ(xi−θ)² (mean) and the sum of absolute deviations...
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...
Implement longest subarray summing to k
Given an integer array nums (length ≤ 200,000; values may be negative) and integer k, return the maximum length and the [l, r] indices of a contiguous...
Match payments to invoices by memo or amount
You are building a small payment-to-invoice matching utility. Data You are given: - invoices: a list of invoice records with: - invoice_id (string) ...
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...
Simulate Coin Flips to Determine Fairness via Empirical Distribution
Scenario You must test whether a coin is fair by simulation. Question Write code that repeatedly simulates n coin flips, records the number of heads, ...
Implement piecewise linear interpolation for time-to-empty
Time-to-Empty from a Discharge Curve (Piecewise Linear Interpolation) Implement a function time_to_empty(checkpoints, current_soc) that returns the nu...
Implement anagram check and stable deduplication
Part A — Anagram checker: Write a function is_anagram(a: str, b: str, locale: str = 'en') -> bool that returns True iff a and b are anagrams under the...
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...
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 ...
Count super-streak segments in an event stream
Problem You are given a time-ordered sequence of events. Each event has: - type (string or int) - ts (timestamp as integer milliseconds/seconds) A str...
Remove Duplicates While Preserving Order in List
Scenario A data pipeline receives an unordered list of IDs containing duplicates; downstream components require a duplicate-free list while preserving...
Normalize Columns in Binomial Matrix Efficiently
Scenario Write code that creates a 100×100 matrix of Binomial(1, 0. 5) samples and normalizes each column so it sums to 1. Question Provide an efficie...