Design a home timeline (Twitter/Instagram style) that shows recent posts from accounts a user follows.
How to approach it
Every system has one signature hard problem the interviewer wants to watch you reason about. Identify it, lay out two or three approaches with their tradeoffs, and recommend one with a clear justification. Depth on the core problem beats breadth across components.
Fan-out strategy
Materialize each user’s home timeline cheaply despite power-law follower counts.
Approaches
| Approach | Tradeoff |
|---|---|
| Fan-out-on-write (push) | fast reads, but a celebrity post writes to millions of timelines |
| Fan-out-on-read (pull) | cheap writes, but reads must merge many authors at request time |
| Hybrid | push for normal accounts, pull-merge for a small set of celebrities |
Tip
Recommended — Hybrid: push to precomputed timelines for normal authors, and merge celebrity posts at read time from a small hot set.