Challenge: Tree Depth

Let’s find the depth of a binary tree using recursion.

Problem

Given a binary tree, find its depth. The depth of the root is 0. The depth of the tree is the number of edges in the longest branch from the root to the leaf.

Input

A binary tree.

Output

Display the depth of the tree.

Sample input

Get hands-on with 1400+ tech skills courses.