Social feed

Write codeHard40 minMeta style

Your task

Design a mini social feed. Support operations replayed in order: ["post", userId, tweetId] records a tweet; ["follow", followerId, followeeId]; ["unfollow", followerId, followeeId]; ["feed", userId] which returns the 10 most recent tweet IDs (newest first) posted by the user or anyone they follow. A user implicitly follows themselves. Return the list of feed results (each a list of tweetIds) for every feed operation, in order.

Examples

mini_twitter(ops: list[list]) -> list[list[int]]
Example 1
Inputmini_twitter([["post", 1, 5], ["feed", 1], ["follow", 1, 2], ["post", 2, 6], ["feed", 1], ["unfollow", 1, 2], ["feed", 1]])
Output[[5], [6, 5], [5]]