Problem · Array
Maximum Satisfied Customers
Learn this problemProblem statement
Each customer lists every item they need, and each shop lists the items it stocks. You may open at most two shops.
A customer is satisfied when every required item is stocked by at least one open shop. Return the maximum number of customers that can be satisfied simultaneously.
Function
maxSatisfiedCustomers(customers: int[][], shops: int[][]) → intExamples
Example 1
customers = [[1,2],[1,5]]shops = [[1,3,4,5],[2,4,6,8],[1,3,4,6]]return = 2Opening the first and second shops makes items 1, 2, and 5 available, satisfying both customers.
Constraints
1 <= customers.length <= 2001 <= shops.length <= 601 <= customers[i].length, shops[j].length <= 201 <= item <= 10^9- Repeated item identifiers in one list have the same meaning as one occurrence.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024