PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Uber

Design a Rolling Event Counter

Last updated: May 2, 2026

Quick Overview

This question evaluates understanding of data structures and time-windowed counting, performance and memory trade-offs, expiration policies, and concurrency when implementing an in-memory rolling event counter.

  • medium
  • Uber
  • Software Engineering Fundamentals
  • Software Engineer

Design a Rolling Event Counter

Company: Uber

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

Design an in-memory rolling event counter. The counter should support two operations: - `record(timestamp)`: record one event at the given timestamp, measured in seconds. - `count(timestamp)`: return the number of events that occurred in the last 300 seconds, including events whose timestamps are in the interval `[timestamp - 299, timestamp]`. Discuss and implement an approach for the single-machine case. Then discuss trade-offs around: - when to remove expired events, - whether to use a background cleanup thread, - how stale data can affect correctness, - memory usage under high traffic, and - concurrency concerns.

Quick Answer: This question evaluates understanding of data structures and time-windowed counting, performance and memory trade-offs, expiration policies, and concurrency when implementing an in-memory rolling event counter.

Related Interview Questions

  • Build a React Parking Lot Manager - Uber (medium)
  • Design a Real-Time Top-K Ranking System - Uber (hard)
  • Design a Parking Lot - Uber (medium)
  • Design a Parking Garage Object Model - Uber (medium)
  • Design follow/follower classes - Uber (medium)
Uber logo
Uber
Jan 30, 2026, 12:00 AM
Software Engineer
Technical Screen
Software Engineering Fundamentals
6
0

Design an in-memory rolling event counter.

The counter should support two operations:

  • record(timestamp) : record one event at the given timestamp, measured in seconds.
  • count(timestamp) : return the number of events that occurred in the last 300 seconds, including events whose timestamps are in the interval [timestamp - 299, timestamp] .

Discuss and implement an approach for the single-machine case. Then discuss trade-offs around:

  • when to remove expired events,
  • whether to use a background cleanup thread,
  • how stale data can affect correctness,
  • memory usage under high traffic, and
  • concurrency concerns.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Uber•More Software Engineer•Uber Software Engineer•Uber Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
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.