leetcode

355. Design Twitter

Solution code

postTweet

Time complexity: O(1)

**Space complexity: O( tweets )**

getNewsFeed

users = one and one’s followees

_u = users _

tweets = users’ tweets

_t = min( tweets , 10)_

Time complexity: O(ulog(u) + tlog(u))

Space complexity: O(u)

follow

Time complexity: O(1)

**Space complexity: O( followers + followees )**

unfollow

Time complexity: O(1)

**Space complexity: O( followers + followees )**
Runtime 10 ms
Beats 30.72%

Memory 41.46 MB
Beats 55.91%