355. Design Twitter

Practice Design Twitter for free on NudgeCode: Medium, Heap pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Design a small social feed.

Each test is a list of operations and their arguments; the expected output lists what each call returns (null for the constructor and for calls that return nothing).

Example

["Twitter","postTweet","getNewsFeed","follow","postTweet","getNewsFeed","unfollow","getNewsFeed"]
[[],[1,5],[1],[1,2],[2,6],[1],[1,2],[1]]
->  [null,null,[5],null,null,[6,5],null,[5]]

Constraints