Maximum Satisfied Customers
Updated
Problem 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 Online Assessment questions
- 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
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
- Process Banking OperationsVercel · OA
- First Completed Mingo LineEpic · OAEpic interview questions
- Count House Segments After Sequential DestructionByteDance · OAByteDance interview questions
- HTTP Request RedirectionAmazon · OA
- Hungarian Lottery Winner CountsAlpaca · OA
- Cheating CodemakerJane Street · OAJane Street interview questions
- Aggregate Paginated Project Run RecordsReplit · OA
- Occupy and Clean Memory by Allocation IDZipRecruiter · OAZipRecruiter interview questions
- Capital Gains Tax from TradesArcesium · OAArcesium interview questions