Calculate Worst-Case Load Factor for Each Service in a DAG
Given a directed acyclic graph representing service dependencies, calculate the worst-case load factor for each service, defined as the total units of load it receives when all upstream services make simultaneous requests starting from an entrypoint with 1 unit of load.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late August, 2026
Given a directed acyclic graph that contains these dependencies, you are tasked with determining the "load factor" for each of these services to handle this load. The load factor of a service is defined as the number of units of load it will receive if the entrypoint receives a 1 unit of load. Note that we are interested in the worst case capacity. For a given downstream service, its load factor is the number of units of load it is required to handle if all upstream services made simultaneous requests. For example, in the following dependency graph where A is the entrypoint: Each query to A will generate one query to B which will pass it on to C and from there to D. A will also generate a query to C which will pass it on to D, so the worst case (maximum) load factors for each service is A:1, B:1, C:2, D:2.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.