Company: DIT intern hiring test
Difficulty: medium
Thread Count A system has service_nodes micro-services, numbered 1 through service_nodes , connected in a tree structure by service_nodes - 1 links. Every micro-service is configured with a maximum thread count , which must be a positive integer: at least one thread. The operations team enforces one rule on top of that - two micro-services that are directly linked must have maximum thread counts that differ by exactly one . Some configurations were lost. Only k micro-services still have a known thread count, given as currentValues[i] = [micro-service index, maximum threads] . Every other micro-service has to be reconfigured from scratch. Choose a maximum thread count for every micro-service so that the rule above holds everywhere and the known values are kept exactly as they are, and report the smallest possible total number of threads over the whole system. It is guaranteed that at least one configuration satisfying all of this exists. Function Description Complete the function getMin