Drop-Off Centers
Updated
Problem statement
Each graph node is a potential drop-off center owned by one company. A contracted company contributes all of its centers. Count non-empty company subsets for which every pair of selected centers is at least minDistance apart by shortest-road distance.
Function
findCount(n: int, graphFrom: int[], graphTo: int[], graphWeight: int[], minDistance: int, company: int[]) → intExamples
Example 1
n = 3graphFrom = [1,2,3]graphTo = [2,3,1]graphWeight = [3,2,5]minDistance = 4company = [1,2,3]return = 4The valid subsets are each singleton and companies 1 with 3.
Constraints
2 <= n <= 10001 <= edges <= n(n-1)/21 <= edge weight, minDistance <= 1001 <= companies <= 10- There is at most one road between a node pair.
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
- Sum Dynamic Weighted Tree DistancesJuspay · OA
- Competitive ForagingAkuna Capital · OAAkuna Capital interview questions
- Minimum Fuel Cost Between CitiesMicrosoft · OAMicrosoft interview questions
- Drone Delivery with Battery Swap StationsCisco · OACisco interview questions
- Delivery ServiceInMobi · OAInMobi interview questions
- Optimal TransferSuperhuman · OASuperhuman interview questions
- Minimum Travel Time With Periodic Fast RoadsAdobe · OAAdobe interview questions
- Find the PathLinkedIn · OALinkedIn interview questions
- Escape the Haunted Castle with TreasuresPersona · OAPersona interview questions
- Energy CrisisRubrik · OARubrik interview questions