Flipkart | Machine Coding Round SDE 2 | News Feed

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-12-13Added By Anonymous
Source: Link
Flipkart | Machine Coding Round SDE 2 | News Feed Question: News Feed Your aim is to write a console program that can simulate a social network. Users have the following capabilities (command to be used in [ - ]): • [signup] A user can signup to the system • [login] A user will be able to login to the system and the session will be created and used across for the other commands. Any existing session will be reinitiated with the new user logins. • [post] A user can post a feed item. • [follow] Users can follow other users. • [reply] A user can comment on another user's feed item. • [upvote/downvote] Upvote or downvote posts. • [shownewsfeed] Any user can read his news feed. News items are sorted based on the following: • Followed users: posts by followed users appear first. • Score (= upvotes - downvotes): higher the better. • The number of comments: higher the better. • Timestamp: more recent the better. Bonus: • Allow users to comment on a comment and upvote/downvote a comment. • Display time in language like 2m ago, 1 hr ago etc. Input and output The input should be taken in the form of statements or driver methods or through a file. The statements should consist of commands and arguments. Commands can include ‘signup’, ‘newsfeed’, ‘upvote’ etc. Arguments can vary depending on the commands. Example - reply(feed_id, reply_text)
Comments