← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026Remote

Summary

Phone screen for a Google SWE role, AI infra track. Two-part coding problem centered on compressed vector storage and dot product computation. Pretty focused session, no behavioral stuff at all.

Questions Asked (2)

Q1

Design a compact storage format for a long integer vector that contains many repeated values. Walk through the tradeoffs between different representations.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

I went straight to run-length encoding (value, count pairs) which felt right for the example they gave.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: what operations are needed (random access, iteration, append), memory constraints, and expected distribution of repeated values. Then propose a run-length encoding (RLE) scheme as a baseline, analyze its tradeoffs, and compare with alternatives like dictionary encoding, delta encoding, or hybrid approaches. Conclude by recommending a format based on the specific use case.

Pro tip: Quantify the tradeoffs with concrete numbers (e.g., memory savings vs. access time) and mention real-world systems like Parquet or ORC that use similar techniques. This shows practical experience and depth.

1. Clarify Requirements

Ask about the expected operations (random access, iteration, append), memory constraints, and characteristics of the data (e.g., average run length, value range). This ensures the design meets actual needs.

2. Propose Baseline: Run-Length Encoding (RLE)

Describe RLE: store pairs of (value, count) for consecutive repeated values. Explain how it compresses long runs and its simplicity.

3. Analyze Tradeoffs of RLE

Discuss pros: excellent compression for long runs, simple encoding/decoding. Cons: poor for random access (need to scan runs), overhead for short runs, and worst-case expansion (e.g., alternating values).

4. Compare Alternative Representations

Consider dictionary encoding (map values to IDs, store IDs), delta encoding (store differences), or hybrid approaches (e.g., RLE for long runs, raw for short). Discuss tradeoffs in compression ratio, access speed, and complexity.

5. Recommend and Justify

Based on the clarified requirements, recommend a format (e.g., RLE with block-based indexing for random access) and justify why it best balances memory and performance.

Key Points to Mention

  • Run-length encoding (RLE) and its variants (e.g., byte-oriented, word-oriented)
  • Tradeoff between compression ratio and random access speed; use of block-based indexing or skip lists
  • Dictionary encoding for low-cardinality data and its memory overhead
  • Delta encoding for sorted or slowly changing sequences
  • Hybrid approaches (e.g., RLE for long runs, raw for short runs) and adaptive encoding
  • Real-world examples: Parquet, ORC, Protocol Buffers packed repeated fields

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Given two vectors of equal logical length, each stored in your compressed format, compute their dot product efficiently.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is the meat of the problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the compressed format and its decoding cost, then propose an algorithm that decodes and multiplies on the fly to avoid materializing full vectors. Discuss trade-offs between time, space, and potential for parallelization or vectorization.

Pro tip: Mention that you would handle edge cases like different compression schemes or zero-length vectors, and that you would benchmark against a naive decode-then-dot approach to validate efficiency.

1. Clarify the compressed format

Ask questions to understand how the vectors are compressed (e.g., run-length encoding, sparse representation, dictionary encoding) and whether random access is supported.

2. Design an on-the-fly algorithm

Propose an algorithm that iterates over the compressed representations simultaneously, decoding only the necessary elements and accumulating the dot product without fully decompressing the vectors.

3. Analyze complexity and trade-offs

Discuss time and space complexity, comparing your approach to naive decoding. Mention potential optimizations like early termination for zeros or using SIMD instructions.

4. Address edge cases and robustness

Consider cases where the vectors have different compression schemes, are empty, or contain special values (e.g., NaN, infinity). Explain how your algorithm handles them.

5. Conclude with practical considerations

Summarize why your approach is efficient for Google-scale data, and mention testing, profiling, and potential parallelization.

Key Points to Mention

  • Understanding the specific compression format and its access patterns
  • Avoiding full decompression by streaming through compressed data
  • Time complexity relative to the number of compressed blocks or non-zero elements
  • Space complexity and memory bandwidth considerations
  • Potential for parallelization or vectorization (e.g., SIMD)
  • Handling edge cases and ensuring numerical stability

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.