Customers Who Bought Everything
purchases has columns customer_id and product_id. products has a column product_id listing every product. Return the ids of customers who bought every product at least once, in increasing order.
Example 1
purchases {"customer_id":[1,1,2],"product_id":[5,6,5]}
products {"product_id":[5,6]}
returns [1]
Only customer 1 bought both 5 and 6.
Constraints
- Every purchased product is in
products - The result may be an empty list
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Date Range FilterMedium
- Deepest Fall per TickerMedium
- Department HeadcountMedium
- Earning More Than the ManagerMedium
- Employee BonusMedium
- Employee DepartmentsMedium
- Find Valid EmailsMedium
- First Time Below ZeroMedium