Company: Teradata
Difficulty: medium
Division nodes Problem Description Given N nodes. There are N - 1 connecting edges between any two nodes. Each node has a value denoted by an array A. Write a program to divide the tree along an edge f so as to minimize the difference between the sums of the node values on either side of the edge. Function description Complete the solve function. This function takes the following 3 parameters and returns the answer. Parameters: N : Represents the count of a number of nodes edges : Represents the edges between nodes A : Represents the value associated with each node Input format for custom testing Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code. The first line contains T denoting the number of test cases. For each test case: The second line contains N . Next N - 1 lines two space-separated integers U_i and V_i denoting that the edge number i connects the nodes U_i and V_i . The next line N space-se