Wells Fargo Interview Question

coding problem is related to "Selling Products" — Minimize distinct IDs