Panda Guru LogoPanda
Guru

Flipkart | SDE 2 Machine Coding

Round 1

Questions: Your aim is to write a console program that can simulate a social network. Users have the following capabilities (command to be used in [ - ]):

Bonus:

Input and output: The input should be taken in the form of statements. The statements should consist of commands and arguments. Commands can be words like ‘signup’, ‘newsfeed’, ‘upvote’ etc. Arguments can be separated from commands by special characters something like ‘~’. As a result, a statement to reply to post 005 can look something like reply~005~this is the reply text.

You may change the input output format without changing the functionality to suit your needs.

Sample: Input is in bold, output is not in bold. You need to print the output of shownewsfeed for a user, whenever he logs in.

signup~lucious signup~albus signup~tom login~tom post~I am going to be the darkest dark wizard of all time post~I am lord Voldemort btw 3:) Login~lucious Follow~tom Shownewsfeed id: 002 (0 upvotes, 0 downvotes) tom I am lord Voldemort btw 3:) 1994-04-19 10:11 PM id: 001 (0 upvotes, 0 downvotes) tom I am going to be the darkest dark wizard of all time 1994-04-19 10:10 PM upvote~001 reply~001~I am with you dark lord! Shownewsfeed id: 002 (0 upvotes, 0 downvotes) tom I am lord Voldemort btw 3:) 1994-04-19 10:11 PM id: 001 (1 upvote, 0 downvotes) tom I am going to be the darkest dark wizard of all time 1994-04-19 10:10 PM id: 003 Lucious I am with you dark lord! 1994-04-19 10:15 PM login~albus post~Happiness can be found, even in the darkest of times, if one only remembers to turn on the light follow~tom downvote~001 downvote~002 reply~002~LOL! shownewsfeed id: 001 (1 upvote, 1 downvotes) tom I am going to be the darkest dark wizard of all time 1994-04-19 10:10 PM id: 003 lucius I am with you dark lord! 1994-04-19 10:15 PM id: 002 (0 upvotes, 1 downvotes) tom I am lord Voldemort btw 3:) 1994-04-19 10:11 PM id: 005 albus LOL! 1994-04-19 10:30 PM id: 004 (0 upvotes, 0 downvotes) albus Happiness can be found, even in the darkest of times, if one only remembers to turn on the light 1994-04-19 10:28 PM --- Guidelines: - Input can be read from a file or STDIN or coded in a driver method. - Output can be written to a file or STDOUT. - Feel free to store all interim/output data in-memory. - Restrict internet usage to looking up syntax. - You are free to use the language of your choice. - Save your code/project by your name and email it. Your program will be executed on another machine. So, explicitly specify dependencies, if any, in your email. Expectations: - Code should be demo-able (very important). Code should be functionally correct and complete. - At the end of this interview round, an interviewer will provide multiple inputs to your program for which it is expected to work. - Code should handle edge cases properly and fail gracefully. Add suitable exception handling, wherever applicable. - Code should have good object-oriented design. - Code should be readable, modular, testable and extensible. Use intuitive names for your variables, methods and classes. - It should be easy to add/remove functionality without rewriting a lot of code. - Do not write monolithic code. - Don’t use any databases. <details> <summary>Candidate's Approach</summary> No approach provided. </details> <details> <summary>Interviewer's Feedback</summary> No feedback provided. </details> ---