ADP Interview Question
SDE-2sCountry: India
Interview Type: Written Test
Generate a list of movies which the users who have watched X have also most frequently watched.
This list can be maintained per-movie, and updated periodically.
During update, the system can search for users who have watched X, and iterate through the other movies they have seen, updating the count in a hash table.
Even better suggestion mechanism would be to,
1. tag each movie with multiple attributes such as Genre, Actor, Actress, Director, Release Year, Language and anything that you can think of.
2. Maintain a nested map data structure where we can push the number of movies watched by the user for the given key, here key will be these attributes. This map will have one more nested map.
3. Based on the top entries search for the movie database for similar movies.
So for ex. If a person has a Map Profile that looks something like
Then filter movies based on Actor IN ('Leo', 'Tom') Actresses IN ('Scarlett', 'Monica') AND Genere IN ('Action') and so on.
- Antriksh March 25, 2017And suggest movie based on the result.
Result can even be more optimized by applying another set of filters on top of this result where a record satisfying more than one entries will be at the top.
Going a step ahead, maintain a user graph with each edge having some weight value. two user with larger intersection between their profile graph can have higher edge weight.
Fetch the movie seen by such adjacent user, filter the movies seen by the neighbor user but not by the current one and add it to our suggestion list.