← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Uber SWE interview with a design-heavy coding round centered on a visitor log system. The question had a lot of layers and the follow-ups kept coming, which I wasn't fully prepared for.

Questions Asked (3)

Q1

Design a VisitorLog class that supports recording (name, timestamp) entries and querying which visitors have been seen exactly once up to a given timestamp.

Algorithms & Data StructuresSystem Design
Author's notes

I jumped straight to a hashmap of name to count and felt pretty good about it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the requirements first: whether queries are online or offline, and if timestamps are strictly increasing. Then propose a solution using a hash map to track visitor counts and a data structure (like a balanced BST or sorted list) to support efficient queries by timestamp, discussing trade-offs between time and space complexity.

Pro tip: Mention that if timestamps are strictly increasing, you can maintain a running set of visitors with count exactly one, enabling O(1) query time. Also, discuss how to handle duplicate entries and the importance of defining the timestamp granularity.

1. Clarify Requirements

Ask about query patterns, timestamp ordering, and whether entries can have duplicate timestamps. Confirm if queries are for a specific timestamp or up to a timestamp.

2. Design Data Structures

Choose a hash map to store visitor counts and a sorted structure (e.g., balanced BST, segment tree, or sorted list) to index visitors by timestamp for range queries.

3. Handle Updates

When recording a new entry, update the visitor's count and adjust the sorted structure if the count transitions to or from 1. Consider using a set to track visitors with count exactly one.

4. Implement Query

For a query up to timestamp T, retrieve all visitors with entries <= T and filter those with count exactly one. If using a sorted structure, perform a range query and intersect with the set of unique visitors.

5. Analyze Complexity

Discuss time and space complexity for both recording and querying, and compare with alternative approaches like offline processing or using a Fenwick tree.

Key Points to Mention

  • Hash map for O(1) average update of visitor counts
  • Balanced BST or sorted list for O(log n) range queries by timestamp
  • Maintaining a dynamic set of visitors with count exactly one
  • Handling duplicate timestamps and out-of-order entries
  • Trade-offs between online and offline query processing
  • Space-time complexity analysis and potential optimizations

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

Q2

How does your solution change if records can arrive out of timestamp order?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I started to sweat.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Acknowledge that out-of-order records break the assumption of monotonic timestamps, then systematically discuss how each component of the solution (e.g., windowing, aggregation, state management) must adapt. Focus on trade-offs between correctness, latency, and resource usage, and propose concrete techniques like watermarks, allowed lateness, and event-time processing.

Pro tip: Emphasize that out-of-order data is the norm in distributed systems, not an edge case—showing you design for it by default demonstrates production maturity. Also, quantify the impact: e.g., 'allowing 5 minutes of lateness increases state size by X% but ensures 99.9% correctness.'

1. Identify affected components

Determine which parts of the solution rely on ordered timestamps, such as windowing, joins, or aggregations, and how they break with out-of-order data.

2. Choose an event-time model

Switch from processing-time to event-time semantics, using watermarks to track progress and handle late data.

3. Define lateness handling

Decide on an allowed lateness threshold and specify actions for late records: drop, update results, or route to a side output.

4. Adjust state and resource management

Account for increased state retention and potential recomputation, and discuss trade-offs like memory vs. accuracy.

5. Validate with examples

Walk through a concrete scenario (e.g., a record arriving 10 minutes late) to illustrate how the modified solution behaves.

Key Points to Mention

  • Event-time vs. processing-time semantics
  • Watermarks and allowed lateness
  • State management and retention policies
  • Trade-offs between correctness, latency, and resource usage
  • Handling late data: dropping, updating, or side outputs
  • Idempotency and exactly-once processing guarantees

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

Q3

What if the visit count is restricted to a sliding time window instead of all records up to a timestamp?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Honestly the hardest follow-up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem by defining the sliding window (e.g., last 5 minutes) and the required operations (record visit, get count). Then propose a data structure like a deque or a time-bucketed counter, and discuss trade-offs in time/space complexity and concurrency.

Pro tip: Mention that sliding window counts are often implemented with a ring buffer of time buckets to balance memory and precision, and highlight how you'd handle out-of-order events or clock skew in a distributed system like Uber's.

1. Clarify requirements

Ask about the window size, expected query rate, and whether events can arrive out of order. Confirm if the count is per user, per page, or global.

2. Choose a data structure

Propose a deque of timestamps for exact counts, or a circular buffer of time buckets for approximate counts with lower memory. Discuss pros and cons.

3. Analyze complexity

Explain time complexity for insertion and query (e.g., O(1) amortized for deque with lazy deletion) and space complexity (O(window size) or O(number of buckets)).

4. Address scalability and concurrency

Discuss how to handle high throughput (e.g., sharding by user ID) and thread safety (e.g., locks or lock-free structures). Mention distributed counting if needed.

5. Consider edge cases

Cover out-of-order events, clock skew, and window boundary conditions. Suggest using event timestamps or watermarks for correctness.

Key Points to Mention

  • Sliding window vs. fixed window: sliding provides more accurate counts but may require more memory or computation.
  • Deque with lazy deletion: store timestamps, remove old ones on query, O(1) amortized per operation.
  • Time-bucketed approach: divide window into buckets (e.g., 1-second buckets), increment counters, and sum relevant buckets for approximate counts.
  • Trade-off between precision and memory: exact counts need O(window size) space, while bucketed counts use O(number of buckets) space.
  • Concurrency: use per-user locks or atomic operations; consider sharding for scalability.
  • Distributed systems: use a distributed cache like Redis with sorted sets or a time-series database; handle clock skew with logical timestamps.

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