For Tree Distances II, the up pass is simple. You already computed answer[1] = down[1] (the sum of distances from node 1 to all others). Now propagate to children.
For each child v of u: answer[v] = answer[u] + n - 2 * size[v]. The - size[v] term accounts for v's subtree nodes getting closer. The + (n - size[v]) term accounts for outside nodes getting farther. You do not need prefix-suffix arrays here because the combine function is addition. Excluding one child's contribution is just subtraction.
This second DFS runs in O(n) time and uses O(n) space.