Minimum Stores to Complete a Shopping List

Given a shopping list and the set of products available at each store, return the minimum number of stores that must be visited to buy every product on the shopping list.

Products on the shopping...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: