Design a solution to find the most visited product in last 2 hours

There are huge number of products identified lets say with product ids in an eCommerce site. We need to display a product to any visiting user which was visited the most by any user in last 2 hours! Design a optimum solution (data structures, algorithm etc) to find such product id & display that to user.

Note that, we don't need to display the top k trending products. We just need to display the one which is highest trending product.

Author: Sachin Randive
Login to Answer
Sort By:
My Answer