Cut The Tree Hackerrank Solution Python Here

Cut The Tree Hackerrank Solution Python Here

You must remove one edge from the tree. Removing an edge will split the tree into two distinct smaller trees (or a tree and a single node). You need to calculate the sum of the data values for the nodes in the first tree ($Sum_1$) and the sum of the data values for the nodes in the second tree ($Sum_2$).

For n = 10^5 , this is efficient and runs in well under a second in Python. cut the tree hackerrank solution python