Company: Graviton_4nov
Difficulty: medium
Town Network Population Counting Problem Description You have a network of towns connected like a tree structure. There are N towns and each town has a special ID (number from 1 to N). Between any two towns, there is only one way to travel. Alice and Bob are studying this town network. To make it more fun, Charlie tells them how many people live in each town. Charlie asks questions to Alice: Charlie gives Alice two towns U and V (they can be the same town) and a number W. Alice needs to count how many towns have people count no more than W along the route from town U to town V. Complete the city_population function. This function takes the following 5 parameters and returns an array of size Q, showing the answer to each question. Parameters: N: Represents the number of towns population: Represents an array of size N, showing the people count in towns road: Represents N-1 arrays, each array shows a connection as given in the problem statement Q: Represents the number of questions cities