Track Approximate Heavy-Hitter Pickup Cells in Fixed Memory

Last updated: November 29, 2026

Quick Overview

A stream of pickup requests tagged with H3 cell ids is too large to count exactly per cell on each node. Implement a fixed-memory structure that reports the hottest cells with provable error bounds.

Uber
Software Engineering Fundamentals
Software Engineer
Uber
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Hard

0

0

0 solved


A stream of pickup requests tagged with H3 cell ids is too large to count exactly per cell on each node. Implement a fixed-memory structure that reports the hottest cells with provable error bounds.

Uber processes request events at a rate where exact per-key counting on every node is wasteful, and memory budgets on stream processors are tight. The interviewer checks whether you know a streaming heavy-hitters algorithm, can implement it efficiently, and can state its guarantees.

What the Interviewer Expects
  • Explain why an exact hash map of all cells does not fit the memory budget
  • Implement Space-Saving (or Misra-Gries) with k counters
  • State the error bound: overestimate at most N/k
  • Make eviction of the minimum efficient
  • Report lower bounds so callers know which results are certain
Key Topics to Cover
Streaming algorithms
Space-Saving
Heavy hitters
Error bounds
Heaps with lazy deletion
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you merge summaries from 100 stream partitions?
  • How does Count-Min Sketch compare, and when would you prefer it?
  • How do you make the counts reflect only the last 10 minutes?
  • What k would you choose to reliably find every cell above 0.5% of traffic?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Process a stream of cell ids, use O(k) memory, and answer "top m cells" at any time. Any cell with true frequency above N/k must appear, and every reported count must come with an error bound....

High-Level Design

Space-Saving keeps k (count, error) counters. A tracked item increments. An untracked item, when the table is full, replaces the item with the minimum count cminc_{min} and starts at cmin+1c_{min} + 1 wit...


Submit Your Answer
Markdown supported