Find Most-Viewed Product by Date
Given an array of e-commerce activity tuples containing user_id, product_id, event_time, and event_type, write a function that returns the product_id with the highest number of 'view' events on a specified date, without using external libraries.
Asked at:
Intuit
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late July, 2026
Intuit
Mid-level
You are given a collection of user activity records from an e-commerce platform. Each record contains: * user_id * product_id * event_time * event_type, such as "view", "cart", or "purchase" Write a function that returns the product that received the highest number of **view events** on a specified date. The input data is provided as an array of tuples: python (user_id, product_id, event_time, event_type) Example: python data = [ (1, 101, "2021-01-01 10:00:00", "view"), (1, 101, "2021-01-01 10:05:00", "cart"), (1, 101, "2021-01-01 10:10:00", "purchase"), (2, 102, "2021-01-02 11:00:00", "view"), (2, 102, "2021-01-02 11:05:00", "cart"), ] The solution should only count records whose event type is "view" and whose timestamp belongs to the requested date. Do not use external libraries. You may also mention how ties and dates with no views should be handled.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.