This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingDecide whether the two sides of every node stay within one level of each other.
What this asks
Decide whether the two sides of every node stay within one level of each other.
One bottom-up walk returns each subtree's height and whether it is balanced, so a gap above 1 fails the check without a second pass.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing