Design Twitter — LeetCode 355 Heap Plus HashMap
LeetCode 355 Design Twitter is a Meta and Amazon favorite. Build the news feed with a hashmap of follows plus a heap merge of recent tweets.
1582 articles
LeetCode 355 Design Twitter is a Meta and Amazon favorite. Build the news feed with a hashmap of follows plus a heap merge of recent tweets.
Implement a file system that creates paths and associates integer values with them. Uses a HashMap mapping full path strings to values with O(L) operations—a pattern used in virtual file systems and etcd.
Design a hit counter that counts requests in the last 5 minutes using a circular buffer with 300 buckets. This O(1) fixed-memory design is used in rate limiters and analytics pipelines at AWS and Cloudflare.
Design a time-stamped key-value store that retrieves the latest value at or before a given time using binary search on sorted timestamp lists. Google and Amazon test this to evaluate versioned data design and binary search mastery.
Design a search autocomplete that returns top 3 historical queries for the current prefix, ranked by frequency. Combines a Trie with per-node frequency maps, a pattern used in Google Search and Bing.