PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Coinbase

Implement top-K over a stream

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's proficiency in stream-processing algorithms and scalable data structures for frequency estimation and top-K queries, emphasizing analysis of time/space trade-offs, sliding-window semantics, and distributed aggregation.

  • Medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Implement top-K over a stream

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

Given a high-volume stream of events (e.g., account IDs from new account openings), design and implement a data structure that supports: ( 1) inserting an item, ( 2) returning the current top-K most frequent items, and ( 3) optionally returning the top-K over the last T minutes (sliding window). Discuss algorithm choices (heaps, bucket counting, count–min sketch with heap), time/space complexities, handling ties, changing K at query time, and window expiration. Outline a scalable distributed approach, including partitioning, partial aggregation, and merge semantics.

Quick Answer: This question evaluates a candidate's proficiency in stream-processing algorithms and scalable data structures for frequency estimation and top-K queries, emphasizing analysis of time/space trade-offs, sliding-window semantics, and distributed aggregation.

Related Interview Questions

  • Implement an In-Memory Database - Coinbase (hard)
  • Implement a Coin-Constrained Jump Strategy - Coinbase (hard)
  • Implement Game Physics and Block Mining - Coinbase (hard)
  • Compute Total Manual Distance - Coinbase (medium)
  • Implement a Flappy Bird Jump Agent - Coinbase
Coinbase logo
Coinbase
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
14
0

Given a high-volume stream of events (e.g., account IDs from new account openings), design and implement a data structure that supports: (

  1. inserting an item, (
  2. returning the current top-K most frequent items, and (
  3. optionally returning the top-K over the last T minutes (sliding window). Discuss algorithm choices (heaps, bucket counting, count–min sketch with heap), time/space complexities, handling ties, changing K at query time, and window expiration. Outline a scalable distributed approach, including partitioning, partial aggregation, and merge semantics.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Coinbase•More Software Engineer•Coinbase Software Engineer•Coinbase Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.