← Coinbase Interview Insights

Coinbase·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jul 2026

Summary

Coinbase system design round for a software engineer role. The whole session was basically one big question about frequency tracking at scale, and they kept pulling the thread on every answer I gave.

Questions Asked (1)

Q1

Design a data structure that handles a high-volume stream of events (like account IDs from new account openings) and supports inserting items, querying the current top-K most frequent items, and optionally querying top-K over a sliding time window. Walk through your algorithm choices, complexity tradeoffs, and how you'd scale this across a distributed system.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

This was basically the entire interview compressed into one question.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (exact vs approximate top-K, time window, latency/throughput targets), then propose a hybrid solution: a hash map for exact counts plus a min-heap or bucket-based structure for top-K, and for sliding windows use time-bucketed counters with periodic aggregation. For distributed scaling, discuss sharding by key, local aggregation with merge, and tradeoffs between accuracy and performance.

Pro tip: Mention that for high-volume streams, approximate algorithms like Count-Min Sketch with a heap are often preferred over exact counting due to memory constraints, and that sliding windows can be implemented with a ring buffer of time buckets to avoid recomputation.

1. Clarify Requirements and Constraints

Ask about data volume, latency requirements, exact vs approximate results, window size, and distributed setup to tailor the solution.

2. Design Core Data Structures

Propose a hash map for frequency counts and a min-heap of size K for top-K, or bucket-based counting for O(1) updates; discuss tradeoffs.

3. Extend to Sliding Window

Use time-bucketed counters (e.g., per-minute) in a ring buffer, and compute top-K over the window by aggregating buckets, possibly with lazy eviction.

4. Analyze Complexity and Tradeoffs

Compare time/space complexity of exact vs approximate methods, and discuss update/query costs, memory usage, and accuracy.

5. Scale Distributedly

Shard by key, have each node maintain local top-K, then merge at a coordinator; consider approximate algorithms for cross-shard aggregation and consistency tradeoffs.

Key Points to Mention

  • Hash map + min-heap for exact top-K with O(1) update and O(log K) query, but O(N) memory.
  • Count-Min Sketch with heap for approximate top-K, trading accuracy for sublinear memory.
  • Time-bucketed sliding window with ring buffer and lazy aggregation to avoid O(N) recomputation.
  • Distributed sharding by key with local aggregation and merge for scalability.
  • Tradeoffs: exact vs approximate, latency vs accuracy, memory vs throughput.
  • Handling hot keys and skew via consistent hashing or splitting.

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