Dot Product of Two Run-Length Encoded Vectors
Asked at Google · Coding Questions · Difficulty: Medium · Last asked Jan 21, 2026
A very long integer vector with many repeated neighbours is stored in run-length form: a list of `(value, run_length)` pairs, where each pair stands for `run_length` consecutive copies of `value`. Compute the dot product of two such vectors without expanding them.
Loading the problem…
More Google interview questions
- LLM conceptual questions
- Implement a Nested Tic-Tac-Toe Game Engine
- ML Fundamentals Deep Dive (AI/ML & MLE Roles)
- ML System Design: Recsys, Chatbot, Image Classifier
- ML Coding: Implement a Simple Attention / Layer Forward Pass
- Longest-Match Greedy Tokenization with Dictionary ID Replacement