← Questions
Fill a second tree with subtree sums of the first
0
I was asked this
No reports yet. Sign in to say where you were asked it.
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 official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
