Note : I am posting this question because the problem link has been removed . ****
If we are given a tree and asked to pick a node as the 'root' node such that the distance between the root and all leaf node is minimum , how do we pick the root ?
We should just print the distance from the root to leaf .
EG : 0->1->2 , we should pick 1 because the distance from 1 to 0 = 1 and distance from 1 to 2 = 1 . We can't pick 0 or 2 because the diatance will be 2 .
Constrains : number of nodes : 100000 value of each node 1<=ai<=100000
Input format : The first line contains N , the number of edges , the following N lines contains two numbers x and y denoting an edge from x to y .
Input : 4