</>
ShikshaCSLearn. Code. Grow.
🔍
☕ Support Us
ShikshaCSâ€ēPractice Problems
DSAMediumTreesRecursion

Maximum Depth of a Binary Tree

📋 Problem

Given a binary tree, find its maximum depth — the number of nodes along the longest path from the root down to a leaf.

🧭 Approach

Use recursion: the depth of a tree is 1 (for the current node) plus the larger of the depths of its left and right subtrees. The base case is a NULL node, which has a depth of 0.

← Back to all Problems