Minimum Service Cold Starts
Updated
Problem statement
A platform contains services numbered from 1 through serviceCount. Each dependency pair [service, dependency] means that starting dependency automatically starts service. Automatic starts continue transitively.
You may cold-start any service directly. Return the minimum number of cold starts required to start every service.
Function
minimumColdStarts(serviceCount: int, dependencies: int[][]) → intExamples
Example 1
serviceCount = 5dependencies = [[2,1],[3,2],[5,4]]return = 2Cold-start services 1 and 4; they transitively start 2, 3, and 5.
Example 2
serviceCount = 3dependencies = [[2,1],[3,2],[1,3]]return = 1Every service lies in one dependency cycle, so starting any one starts all three.
Constraints
1 <= serviceCount <= 1000000 <= dependencies.length <= 200000- Each pair contains two valid service numbers.
- Duplicate dependency pairs may appear and do not change the answer.
Source note: Interview prompt excerpt preserved as source evidence.
More InMobi Online Assessment questions
- Validate a Bracket SequenceOA · Seen Oct 2026
- Count Substrings Matching with One Adjacent SwapOA · Seen Oct 2026
- Maximum Subarray with Start and End WindowsOA · Seen Oct 2026
- Range Maximum Subarray Sum QueriesOA · Seen Oct 2026
- Connected Components with Divisor ThresholdOA · Seen Aug 2026
- Maximize Impression ValueOA · Seen Aug 2026
- Supply Path OptimizationOA · Seen Aug 2026
- Delivery ServiceOA · Seen Jun 2026
- Shared InterestOA · Seen Jun 2026
- Temporal AnomaliesOA · Seen Jun 2026
Similar questions at other companies
- Disaster RecoveryHeadlands Technologies · OAHeadlands Technologies interview questions
- Lowest Common Ancestor with a Changing RootInfosys · OAInfosys interview questions
- Largest Consistent Visiting GroupAuxoAI · OA
- Minimum Tree Diameter After Removing K LeavesMathWorks · OAMathWorks interview questions
- Sum Dynamic Weighted Tree DistancesJuspay · OA
- Recoverable Elements from Range-Sum MeasurementsEthos Life · OA
- Optimal TransferVisa · OAVisa interview questions
- Divide Tree NodesGoogle · OA · ONSITE INTERVIEWGoogle interview questions
- Evolving Merchant Clusters and Persistent PinsStripe · OAStripe interview questions
- Alien DictionaryIntuit · OAIntuit interview questions