← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Uber SWE interview with a two-part coding problem: first build a hit counter with multi-key support over a rolling 5-minute window, then layer a rate limiter on top of it. Pretty focused session, no fluff.

Questions Asked (2)

Q1

Design a hit counter that tracks the number of hits in the last 5 minutes, with support for multiple independent keys (like 'a', 'b', etc.).

Algorithms & Data StructuresSystem Design
Author's notes

The multi-key part tripped me up more than the sliding window logic.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: single-node vs distributed, exact vs approximate counts, and read/write patterns. Then propose a design using a sliding window with per-key timestamp buckets (e.g., per-second granularity) and discuss trade-offs between memory, accuracy, and concurrency. Finally, extend to distributed systems using sharding and aggregation.

Pro tip: Mention that for high-throughput systems, approximate counting with probabilistic data structures (like count-min sketch) or sampling can be acceptable, but always confirm with the interviewer. Also, highlight the importance of handling clock skew and idempotency in distributed settings.

1. Clarify Requirements

Ask about scale (QPS, number of keys), accuracy needs, latency requirements, and whether the system is distributed. Confirm if the 5-minute window is sliding or fixed.

2. Choose Data Structure

Propose a per-key sliding window using a circular buffer of timestamps or a map of timestamp buckets (e.g., per-second counts). Discuss memory vs accuracy trade-offs.

3. Handle Concurrency

Address thread safety with locks or lock-free structures, and consider read/write contention. For distributed, discuss sharding by key and using a shared store like Redis with TTL.

4. Optimize and Scale

Discuss eviction of old buckets, memory management, and potential use of approximate algorithms (e.g., count-min sketch) if exact counts aren't required.

5. Summarize and Trade-offs

Recap the design, highlight trade-offs (memory, accuracy, complexity), and mention monitoring and failure handling.

Key Points to Mention

  • Sliding window vs fixed window and their implications
  • Per-key data isolation and memory overhead
  • Timestamp bucketing (e.g., per-second) to reduce storage
  • Concurrency control (locks, atomic operations, sharding)
  • Distributed design: sharding by key, using Redis sorted sets or TTL
  • Approximate counting for high scale (count-min sketch, sampling)

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

Q2

Using the hit counter you just built, implement a basic rate limiter.

System DesignTechnical Trade-offs
Author's notes

This part felt more natural once the counter was done.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: what exactly is being rate limited (e.g., requests per user/IP), the desired limit, and the time window. Then, leverage the existing hit counter to track counts per key, and implement a rate limiting algorithm such as fixed window or sliding window, discussing trade-offs. Finally, outline how to enforce the limit and handle edge cases like distributed environments.

Pro tip: Demonstrate awareness of distributed systems challenges: even a simple rate limiter needs to handle multiple servers, so mention using a centralized store like Redis and atomic operations to avoid race conditions.

1. Clarify Requirements

Ask questions to understand the scope: what is the rate limit (e.g., 100 requests per minute), what key is used (user ID, IP), and whether it's per endpoint or global. Also confirm if the system is distributed.

2. Choose Algorithm

Select a rate limiting algorithm (e.g., fixed window, sliding window, token bucket) based on trade-offs between accuracy, memory, and complexity. Explain why you chose it.

3. Leverage Hit Counter

Use the existing hit counter to increment counts per key and time window. If the counter is in-memory, discuss how to adapt it for distributed use (e.g., Redis with TTL).

4. Implement Enforcement

Describe how to check the count against the limit and reject or allow requests. Include how to handle the response (e.g., HTTP 429) and possibly include headers like Retry-After.

5. Address Edge Cases and Trade-offs

Discuss race conditions, atomicity, clock skew, and scalability. Mention how to handle bursts and whether to use a sliding window for smoother limiting.

Key Points to Mention

  • Fixed window vs. sliding window vs. token bucket algorithms and their trade-offs
  • Using Redis or a centralized store for distributed rate limiting with atomic operations (e.g., INCR, EXPIRE)
  • Handling race conditions and ensuring atomicity in counter increments
  • Setting appropriate TTLs for counters to avoid stale data
  • Returning proper HTTP status codes (429 Too Many Requests) and headers (Retry-After, X-RateLimit-*)
  • Considering performance impact and scalability of the rate limiter

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