The Design Twitter interview question asks you to build a simplified version of a social media platform. You need to implement core features: posting a tweet, following or unfollowing other users, and retrieving a user's news feed. The news feed should consist of the 10 most recent tweets from the user and the people they follow, sorted from newest to oldest.
This is one of the most popular design questions at companies like Apple, Uber, and Meta. It tests your ability to handle complex relational data and perform efficient "Top K" merging. It evaluations your proficiency with the heap interview pattern for merging multiple sorted streams and the hash table design pattern for managing user relationships and tweet history. It’s a perfect bridge between basic data structures and high-level system design.
This problem uses Hash Tables and a Max-Heap (Priority Queue).
Map<Integer, Set<Integer>> to track followers and a Map<Integer, List<Tweet>> to store tweets for each user.[102, 101].Practice the "-way Merge" pattern using a Heap. It's the standard solution for merging multiple sorted arrays or lists into a single sorted output, which is the heart of the news feed logic.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Design Task Manager | Medium | Solve | |
| Smallest Number in Infinite Set | Medium | Solve | |
| Design a Number Container System | Medium | Solve | |
| Design Authentication Manager | Medium | Solve | |
| LRU Cache | Medium | Solve |