← Uber Interview Insights

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

Senior
May 2026

Summary

Uber SWE interview with a system design question that was essentially a versioned graph problem. Harder than it sounds if you've only seen the basic snapshot array LC problem.

Questions Asked (1)

Q1

Design a social network where the follow graph supports point-in-time snapshots. You need follow, unfollow, createSnapshot, and isFollowing operations, where isFollowing can query any historical snapshot by version id.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

My first instinct was to copy the whole adjacency list on every snapshot, which is obviously wrong at scale and they pushed back immediately.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then propose a versioned adjacency list using persistent data structures (e.g., copy-on-write or versioned edges) to support snapshots efficiently. Discuss trade-offs between storage, read latency, and write throughput, and outline how to handle distributed storage and caching for point-in-time queries.

Pro tip: Emphasize that snapshots should be immutable and cheap to create by sharing unchanged data, and mention that version IDs can be timestamps or monotonically increasing counters. Also, discuss how to garbage-collect old snapshots based on retention policies.

1. Clarify Requirements and Scale

Ask about expected number of users, follows per user, snapshot frequency, query patterns, and retention. Determine if snapshots are global or per-user, and if isFollowing must be strongly consistent.

2. Design Core Data Model

Propose a versioned edge store: each follow relationship is an edge with a validity interval [start_version, end_version). Use a persistent data structure like a copy-on-write B-tree or a log-structured merge tree to share unchanged data across snapshots.

3. Implement Operations

For follow/unfollow, append a new edge version or update the current version. For createSnapshot, record the current version ID (e.g., a timestamp or sequence number) and optionally persist a reference to the immutable state. For isFollowing, query the edge store for edges valid at the given snapshot version.

4. Address Scalability and Distribution

Shard the graph by user ID, replicate for fault tolerance, and use caching for hot snapshots. Discuss how to maintain consistency across shards and how to handle cross-shard queries for isFollowing.

5. Discuss Trade-offs and Optimizations

Compare storage overhead vs. query latency, consider compression of old snapshots, and propose indexing strategies (e.g., per-user edge lists sorted by version) to speed up isFollowing.

Key Points to Mention

  • Persistent data structures (e.g., copy-on-write, immutable B-trees) for efficient snapshots
  • Versioning scheme: monotonic version IDs or timestamps, and validity intervals for edges
  • Storage trade-offs: full snapshots vs. delta encoding vs. versioned edges
  • Query optimization: indexing edges by (follower, followee, version) and caching
  • Distributed design: sharding by user, replication, and consistency models
  • Garbage collection and retention policies for old snapshots

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