Company: Teradata_2Nov
Difficulty: medium
Village Route Population Sum Query Problem Description You have a network of villages connected as a tree structure. There are N villages, and each village has a distinct identifier. Between any pair of villages, there is exactly one connecting route. You are given two villages U and V which might be the same village and a number W. Calculate the total population of villages that have population not exceeding W along the route from village U to village V. Function description Complete the city_population function. This function takes the following 5 parameters and returns an array containing the total population of villages that have population not exceeding W along the route from U to V for each query. Parameters: N: Represents an integer showing the number of villages A: Represents an array showing the population of each village road: Represents an array showing the links between villages Q: Represents an integer showing the number of queries cities: Represents an array showing the q