Company: Uber_all
Difficulty: medium
Graph Construction (Network of Hubs) Problem Description Uber's city infrastructure team is analyzing a network of service hubs across a metropolitan area. Each hub is connected in a tree-like structure (no cycles, all hubs connected). Each hub is assigned a unique integer value that represents its operational efficiency score. Uber's operations team needs to answer multiple queries about sub-networks of hubs. Specifically, they want to count how many hubs within a given sub-network (including the queried hub itself and all hubs beneath it in the hierarchy) have a prime efficiency score. An efficiency score of 1 is not considered prime. Graph Construction (Network of Hubs) There are n hubs, numbered 1 through n. The hubs are connected with m = n - 1 undirected links, forming a tree. Hub 1 is always considered the main root hub of the network. Function Description Complete the function efficiencyScores in the editor. The function accepts the following parameters: int n : the number of n