There is an undirected connected tree with
n nodes labeled from
n - 1 and
n - 1 edges.
You are given the integer
n and the array
edges[i] = [ai, bi] indicates that there is an edge between nodes
bi in the tree.
Return an array
answer of length
answer[i] is the sum of the distances between the
ith node in the tree and all other nodes.