← Questions
Check that each tree node equals its subtree's average
0
I was asked this
No reports yet. Sign in to say where you were asked it.
For a binary tree, decide whether every node's value equals the average of the values in its subtree (or of the nodes below it, as the interviewer defines it), or count the nodes for which that holds. A post-order walk that returns each subtree's sum and size does it in one pass.
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
