Max Depth of Binary Tree

Given a binary tree, find its maximum depth.

The maximum depth of a binary tree is the number of nodes along the longest path from the root node down to the farthest leaf node.

NOTE : The path has to end on a leaf node.

Example :

         1
        /
       2

max depth = 2.

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
6007 successful submissions.
Asked In:
  • Goldman Sachs
  • Facebook
  • Bloomberg
  • Microsoft
Click here to jump start your coding interview preparation