Feature #14: Find Similar Products
Implement the "Find Similar Products" feature for our "Amazon" project.
We'll cover the following
Description
We want to create a product recommendation system. Product recommendations are an important business function. It’s important and beneficial for a business to recommend the right products to groups of users with similar tastes and interests. To recommend the right products, first, we must find people with similar tastes.
We are given the products that were purchased recently by two users. We want to find how similar their purchases were by finding the products that they both purchased.
Suppose we have 1000
products in total and each user can buy a maximum of 1000
products at a time. Given two arrays that represent the products recently bought by the two users, our task is to find all the items that both of them purchased.
Note: We don’t need to fetch an item twice if both the users have purchased it twice.
Let’s look at an example to better understand this:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.