FunctionRacerProblemsRace

Customers Who Bought Everything

MediumpandasPython

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems