Question
Design a mini Twitter and process a list of operations: ['postTweet', userId, tweetId], ['follow', followerId, followeeId], ['unfollow', followerId, followeeId], and ['getNewsFeed', userId]. getNewsFeed returns the 10 most recent tweet ids (newest first) posted by the user or anyone they follow. A user always implicitly follows themselves; following yourself explicitly is a no-op. Return the list of feeds produced by each getNewsFeed op.
twitter_feed(ops: list[list]) → list[list[int]][[["postTweet",1,5],["getNewsFeed",1],["follow",1,2],["postTweet",2,6],["getNewsFeed",1],["unfollow",1,2],["getNewsFeed",1]]]out[[5],[6,5],[5]]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.