Google Data Scientist Coding & Algorithms Interview Questions

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

22 Questions 1 Company02.08.2026
Showing 20 results
Role
Google logo
Google
Medium
Data Scientist Locked

Implement sampling and subarray algorithms

Solve uniform 2D square sampling and longest increasing contiguous subarray. The solution maps Uniform(0,1) to Uniform(-1,1), proves uniformity by ind...

Coding & Algorithms
8
0
82 people solved
Mar 9, 2025
Google logo
Google
Easy
Data Scientist

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...

Coding & Algorithms
9
1
81 people solved
Feb 8, 2026
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
4
0
41 people solved
Oct 13, 2025
Google logo
Google
Easy
Data Scientist Locked

Implement sampling, subarray scan, and percentile estimate

This multi-part problem evaluates skills in random sampling and geometric probability for uniform 2D sampling, algorithmic array processing for findin...

Coding & Algorithms
8
1
84 people solved
Feb 1, 2026
Google logo
Google
Medium
Data ScientistSenior+

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...

Coding & Algorithms
2
0
37 people solved
Nov 24, 2025
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
10
0
82 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
7
0
64 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
4
0
49 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Determine If Two Strings Are Anagrams Efficiently

Scenario Backend service needs to verify whether two user-provided strings are anagrams for text-matching features. Question Implement a Python functi...

Coding & Algorithms
12
0
49 people solved
Jul 12, 2025
Google logo
Google
Medium
Data Scientist

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 ...

Coding & Algorithms
4
0
56 people solved
Feb 5, 2025
Google logo
Google
Easy
Data Scientist

Count super-streak segments in an event stream

You are given a time-ordered sequence of events. Each event has: - type, a string or integer event type. - ts, an integer timestamp in milliseconds or...

Coding & Algorithms
12
0
92 people solved
Jan 2, 2025
Google logo
Google
Easy
Data Scientist Locked

Build next-word predictor with O(1) lookup

This question evaluates skills in language modeling, data structures, algorithmic optimization, and probabilistic sampling, within the Coding & Algori...

Coding & Algorithms
4
1
43 people solved
Feb 2, 2026
Google logo
Google
Medium
Data ScientistSenior+

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...

Coding & Algorithms
6
0
56 people solved
Nov 24, 2025
Google logo
Google
Easy
Data Scientist

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...

Coding & Algorithms
8
0
57 people solved
Oct 25, 2025
Google logo
Google
Medium
Data Scientist

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) ...

Coding & Algorithms
5
0
51 people solved
Oct 19, 2025
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
6
0
49 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
8
0
68 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

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, ...

Coding & Algorithms
6
0
60 people solved
Aug 4, 2025
Google logo
Google
Medium
Data Scientist

Implement Sampling and Minimize Loss in Numerical Coding

Scenario Numerical coding challenges on sampling and loss minimization. Question a) Implement functions to sample from truncated normal distributions ...

Coding & Algorithms
24
0
91 people solved
Jul 12, 2025
Google logo
Google
Medium
Data Scientist

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...

Coding & Algorithms
14
0
31 people solved
Jul 12, 2025

Explore more Google Data Scientist interview questions

Real questions from candidate reports, grouped by topic.

Other Google Data Scientist categories
Browse all