Company: Teradata_2Nov

Difficulty: medium

Problem Statement

Village Route Population Sum Query Problem Description You are given a network of N villages linked together in a tree layout, each village bearing a distinct identifier, so that exactly one route connects any pair of villages. You will be given two villages U and V (they may coincide) along with a threshold W. Work out the combined population of every village along the route from U to V whose population does not exceed W. 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 queries Input format for custom te

More Teradata_2Nov OA questionsInterview experiences