← Questions
Print each tree node's level and whether it is balanced
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given a tree, walk it with a depth-first search and report, for every node, its level and whether the subtree under it is balanced (by the definition the interviewer gives, such as child heights or subtree sums differing by at most a limit). The statement is long, so pin down the input format and the exact balance rule first, compute what you need bottom-up in one pass, and test your own code.
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
