recursively
.Example:
1
/ \
2 3 ==> height=3
/ \ / \
4 5 6 7
depth
of left
and right
subtrees.null
, return 0
.left
subtree by calling findHeight(root.left)
.right
subtree by calling findHeight(root.right)
adding 1
to account for the root node).public int findHeight(TreeNode root) { }
C
Java
Python