Interview prep / Google ML basics, search & content systems
Google interview practice Candidates report ML basics in phone screens, then design rounds about search, writing tools, video, and moderation.
Each question was reported by a candidate in a public interview write-up, linked on the question. We reword the prompt and write our own answer checkpoints. Reports are candidate accounts, not statements from Google, and the company may have changed its questions since.
Coding progress comes from your submissions. Use the answer checkpoints below to review your explanations and design decisions.
Target roleAll roles ML Engineer Applied Scientist Data Scientist Question typeAll rounds Coding ML fundamentals System design DifficultyAll difficulties Easy Medium Hard Search questions
8 questions · 255 min suggested practice
Coding Medium 20 min
Implement k-means clustering Reported by a candidate · ML Engineer · Phone screen · Dec 2019 · LeetCode Discuss · Google MLE, Bangalore ↗
Write k-means clustering from scratch in a shared document, in any language. Explain how you initialize the centroids, when you stop, and what happens when a cluster becomes empty.
Review Unsupervised Learning → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Alternate two steps: assign each point to its nearest centroid, then move each centroid to the mean of its points. Stop when assignments no longer change or the centroid movement falls below a tolerance, with a maximum number of iterations. Say how you handle an empty cluster and why the result depends on initialization (for example, k-means++ or several restarts). Follow-up: How would you choose k when you do not know it in advance?
ML fundamentals Easy 15 min
Answer rapid ML basics Reported by a candidate · ML Engineer · Phone screens · Dec 2019 · LeetCode Discuss · Google MLE, Bangalore ↗
Explain precision and recall, how you detect and avoid underfitting and overfitting, and what regularization and dropout do. A later screen in the same report added gradient descent and k-fold cross-validation.
Review Evaluation Metrics → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Define precision and recall from the confusion matrix and give a case where each one matters more. Compare training and validation error to tell underfitting from overfitting, and name a fix for each. Explain L1 and L2 penalties, and that dropout randomly removes units during training and is turned off at inference. Follow-up: Why does k-fold cross-validation give a better estimate than one validation split?
System design Hard 40 min
Predict which search links to show Reported by a candidate · ML Engineer · Onsite design · Dec 2019 · LeetCode Discuss · Google MLE, Bangalore ↗
You have logs with a user ID, a timestamp, the search query, and the links the user clicked. Design an ML system that decides which links to show for a query.
Review Recommender Systems → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Frame it as ranking: retrieve candidate links, then score them for the query and user. Treat clicks as noisy labels: account for position bias and for links that were never shown. Evaluate offline with a ranking metric such as NDCG and confirm with an online experiment. Follow-up: How do you rank a link that is new and has no clicks yet?
System design Hard 45 min
Correct spelling and grammar as the user types Reported by a candidate · ML Engineer · Onsite design + coding · Dec 2019 · LeetCode Discuss · Google MLE, Bangalore ↗
Design an ML system that finds spelling and grammar errors in a document while the user types, and suggests corrections. Then write the code that uses the model output to show suggestions in real time.
Review Natural Language Processing → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Separate fast spelling candidates (edit distance against a vocabulary) from a slower context model for grammar. Set a latency budget per keystroke; run the model on changed text only and debounce requests. Measure precision of suggestions carefully, since false corrections annoy users more than missed ones. Follow-up: How would you support a new language with little labeled data?
System design Hard 45 min
Detect ad boxes in videos Reported by a candidate · ML Engineer · Onsite design + coding · Dec 2019 · LeetCode Discuss · Google MLE, Bangalore ↗
Design an ML system that detects advertisement boxes inside videos. Then write code that uses the model to return the time range and the position of every ad box in a video.
Review Computer Vision → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Run an object detector on sampled frames instead of every frame, and explain the sampling rate trade-off. Merge detections across frames into tracks using box overlap (IoU), then report each track's start, end, and position. Evaluate with detection metrics and check false positives on content that only looks like an ad. Follow-up: How would you get labeled training data for this?
System design Hard 40 min
Design a content moderation system Reported by a candidate · ML Engineer · ML system design · Nov 2024 · LeetCode Discuss · Google MLE L6 ↗
Design an ML system that finds content that breaks a platform's policies. The candidate could not share the exact wording.
Review Evaluation Metrics → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Define the policy classes, and decide which actions are automatic and which go to human review. Handle strong class imbalance and labels that change as policies change. Choose thresholds from precision-recall curves per class, and monitor for new kinds of abuse. Follow-up: How do you measure how much harmful content the system misses?
ML fundamentals Medium 30 min
Classify 500 tree species from images Reported by a candidate · ML Engineer · ML domain round · Jul 2024 · LeetCode Discuss · Google SWE III (ML) ↗
Build a model that classifies images into 500 types of trees. Discuss the approach, the loss function, and the metrics. Then explain how you would improve the user experience, decide when the model is good enough, and why it trains faster on a GPU than a CPU.
Review Computer Vision → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Use a pretrained CNN and fine-tune it with softmax cross-entropy over 500 classes. Report top-1 and top-k accuracy and per-class results, since some species will have few images. Explain that GPUs run many matrix multiplications in parallel, and set a quality bar based on what users need. Follow-up: Two species look almost the same. How would you reduce confusion between them?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Treat each array as a class and the query as a point to classify. Compare simple approaches: nearest neighbors, or distance to each class mean scaled by its spread. Discuss ties, very different array sizes, and overlapping ranges. Follow-up: How would you give a probability instead of a single answer?