Flipkart || SDE-1 || Offer || 2021
Anonymous User
3108

Experience: 6 months
Application process: Employee Referral
Interview process:
Round1- Machine Coding (90 mins)
Round2- DSA (1 hr)
Round3- Hiring Manager (45 mins)

Round1: (Machine Coding)

Music Recommendation system

Problem Definition:
Create an online music recommendation system which suggests songs according to user taste.

Features:
Application has two major things :
The songs, which are cataloged in the app’s data store. Songs can be described by attributes such as genre, tempo, singer.
The people : Each person has a playlist of songs that they can choose to play from.

Design a system that recommends a set of songs from our music library to the user based on his preferences (matching genre / singer/ tempo) taking into account his current playlist.
Pick a song based on the following order:
One which matches with maximum matching attributes.
When only one attribute is matching, pick one in the following order : genre > singer > tempo.
To decide priority between two genres\singer\tempo, consider the number of songs in each category in the user's playlist to decide which song gets more priority. One with a higher number of songs gets high priority. If the number of songs are the same, show in any order.

Show the recommended songs in a sorted order(Most matched one first, least matched in the last)

Requirements:
Add a new song to the data store.
Add a new user to the system.
Create a playlist for the user
Add songs to the user’s playlist
Display user’s playlist
Recommend songs based on user preferences
Extend the system to let users add friends.
add_friend(“user1”, “user2”) //user1 can see user2 playlist and vice versa
follow_user(“user1”,”user2”) //user1 can see user2 playlist but not vice versa
Bonus question:
Recommend songs based on the user and his friends playlist.
Shuffle a playlist for the user, user should be able to go to the last played song.

Other Details:
Do not use any database or NoSQL store, use in-memory store for now.
Do not create any UI for the application.
Code should be demo-able. Write a driver class for demo purpose, which will execute all the commands at one place in the code and test cases.
Code should be extensible. Wherever applicable, use interfaces and contracts between different methods
Work on the expected output first and then add good-to-have features of your own.
Try to read the test cases from a file or console.

Test Cases:
(Test cases are defined for understanding feature requirements only. Please model it appropriately based on your service implementation)

Assuming following songs exist in appstore

Song1 {name:“song1”, singer:“AB”, genre:”Folk”, tempo:60}
Song2 {name:“song2”, singer:“DEF”, genre:”Rock”, tempo:70}
Song3 {name:“song3”, singer:“AB”, genre:”Country”, tempo:55}
Song4 {name:“song4”, singer:“XYZ”, genre:”Rock”, tempo:60}
Song5 {name:“song5”, singer:“XYZ”, genre:”Rock”, tempo:75}
Song6 {name:“song6”, singer:“AB”, genre:”Country”, tempo:60}
Song7 {name:“song7”, singer:“DEF”, genre:”Indie”, tempo:55}

Here are the sample test cases to run:

add_song(name:“song8”, singer:“AB”, genre:”Folk”, tempo:60)
add_user (name:“user1”)
create_playlist ( “user1”, “playlist1”, {“song1”, “song2”, “song3”})
add_song_to_playlist (“user1”, “playlist1”, “song4”)
show_playlist (“user1”, “playlist1” )
add_friend(“user1”, “user2”)
add_follow(“user1”, “user2”)
view_friend_playlist(“friend1”)
recommend_songs(“user1”)
Song 8 - matching all 3 attributes (singer, genre, tempo - all matching with song1)
Song 5 - matching two attributes (genre ‘Rock’ has 2 songs in user playlist hence it is given priority)
Song 6 - matching two attributes
Song 7 - Single matching attribute

Round 2:
DS Algo/Problem Solving

I was asked 3 coding questions
https://leetcode.com/problems/container-with-most-water/
Come up with linear O(n) time complexity appraoch and O(n) space complexity and then interviewer told me to optimise space to O(1).After some thinking i was able to.

https://leetcode.com/problems/find-duplicate-subtrees/
Brute Force appraoch and then linear time complexity
**
Random number generator which output unique number every time .**
Earlier i suggested a O(n) time complexity approach and then optimise it to O(1) time complexity.

Round 3:
Hiring Manager round

The interviewer asked me 2 puzzles one is a variation of bubble sort and the other one is related to binary search.
Then we discussed about the current project on which i worked and asked me about all the technical abbrevations that i wrote in my resume.(Spring boot developer so things like - hibernate , JPA tools , authzed etc).

Finally got offer after a long wait of 10 days.
Interview process was smooth but offer making process was very slow.

Also, before this I had faced a lot of rejections from:
Swiggy, Commvault , Sharechat to name a few :).

You just need one offer:)
Good luck! Keep hustling!

Comments (10)