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 :


max depth = 2.

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