Given a binary tree, write a method to find its height

An empty tree has a height of 0.

`recursively`

.An empty tree has a height of 0.

Example:

1

/ \

2 3 ==> height=3

/ \ / \

4 5 6 7

Need a **hand?** Try out these hints, one at a time.

Height of a binary tree is the number of nodes in the longest path from the root to its deepest node.

The key here is to find the

Height of the binary tree will be the maximum of the two heights plus one, to account for the root.

`depth`

of `left`

and `right`

subtrees.Height of the binary tree will be the maximum of the two heights plus one, to account for the root.

1. If the root is

2. Find the height of the

3. Find the height of the

4. Compare the two heights and return the maximum of the two (after

`null`

, return `0`

.2. Find the height of the

`left`

subtree by calling `findHeight(root.left)`

.3. Find the height of the

`right`

subtree by calling `findHeight(root.right)`

4. Compare the two heights and return the maximum of the two (after

`adding 1`

to account for the root node).public int findHeight(TreeNode root) { }

**C**

**Java**

**Python**