Dsa
Trees
Medium
Max Leaf Depth
Given a binary tree, determine the maximum depth of the leaves. The depth of a leaf is defined as the number of edges from the root to that leaf. If the tree is empty, return 0. For example, given the following tree:
1
/ \
2 3
/
4
/ \
5 6
The maximum leaf depth is 3 (the leaf 5 has a maximum depth of 3).
Input Format:
A list of integers representing the tree in level order, where -1 indicates a null node.
Output Format:
An integer representing the maximum leaf depth.
Key concepts
treedepthrecursion
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now