Company: Komprise
Difficulty: medium
City population Problem Description Given a city network in the form of a tree. There are N cities and each city has a Unique ID (integer from 1 to N). There exists a unique path between each pair of cities. Steve and Toddler are observing the city network. To make the task interesting, Bob gives the population of each city. Bob asks queries from Steve: Bob gives Steve two cities U and V (may or may not be the same) and an integer W. Steve needs to tell the number of cities that have a population at most W on the path from U to V. Function description Complete the solve function. This function takes the following 5 parameters and returns an array of size Q representing the answer to each query: N : Represents the number of cities population : Represents an array of sizes of N, denoting the population of cities road : Represents N-1 arrays, each array represents a road as given in the problem statement Q : Represents the number of queries cities : Represents Q arrays, each array represe