Fill a second tree with subtree sums of the first
You get the roots of two complete binary trees with exactly the same shape. For every node of the second tree, set its value to the sum of the subtree rooted at the matching node of the first tree. Walk both trees together in one post-order pass, and state the time and space it takes.
No answer yet. Write the first one; the best answer gets endorsed.
