...

/

Solution Review: Tree Depth

Solution Review: Tree Depth

Let’s take a detailed look at the previous challenge’s solution.

Solution

We find the depth of a tree by recursively traversing the left and right child of the root. At each level of traversal, we calculate the depth of both left and right children. The greater depth among the left and right ...