← Openai Interview Insights

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

Senior
Jun 2026

Summary

OpenAI system design round focused on a follow graph with snapshot versioning. The core problem wasn't hard to set up but the trade-off discussion got pretty deep pretty fast.

Questions Asked (1)

Q1

You have a social graph with follow and unfollow operations. Add snapshot support so the system can record the state of the graph at a given point in time. Given a snapshot ID and two users A and B, determine whether A was following B at that snapshot.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

I started with the naive approach, full copy of the graph per snapshot, which works but blows up in space if you have millions of users and frequent snapshots.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: snapshot frequency, expected query patterns, and consistency needs. Then propose a versioned edge model where each follow/unfollow is stored with a timestamp or version, and snapshots are represented as a cutoff point. For point queries, use binary search on the edge history to check if A followed B at the snapshot time.

Pro tip: Discuss the trade-off between storage overhead and query latency: keeping full history enables efficient point queries but uses more space, while periodic full snapshots save space but make point queries slower. Choose based on read/write ratio and snapshot frequency.

1. Clarify Requirements

Ask about snapshot frequency, query patterns (point vs. range), consistency guarantees, and scale (number of users, edges, snapshots).

2. Design Data Model

Propose storing each follow/unfollow as a versioned edge with a timestamp or version number. Snapshots are represented as a cutoff version or timestamp.

3. Implement Snapshot Query

For a given snapshot and users A and B, retrieve the edge history for (A,B) and binary search for the latest event before the snapshot time to determine the follow state.

4. Optimize and Trade-offs

Discuss optimizations like indexing, caching, or periodic snapshots. Compare storage vs. query latency trade-offs and choose based on requirements.

5. Handle Edge Cases

Consider concurrent updates, snapshot consistency, and scalability. Mention how to handle missing edges or out-of-order events.

Key Points to Mention

  • Versioned edges with timestamps or version numbers to capture follow/unfollow history.
  • Binary search on edge history for efficient point queries at a snapshot.
  • Trade-off between storage overhead (full history) and query latency (periodic snapshots).
  • Indexing strategies to quickly retrieve edge history for a user pair.
  • Consistency guarantees: snapshots should reflect a consistent state, possibly using versioning or MVCC.
  • Scalability considerations: sharding by user, using distributed storage, and caching frequent queries.

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