Question bank › Trees
Dsa Trees Medium

Max Depth with Leaf Nodes

Calculate the maximum depth of a binary tree while counting its leaf nodes. The input consists of the number of nodes followed by the node values in level order. The output should be two integers: the maximum depth of the tree and the number of leaf nodes. Example Input: 5 1 2 3 null null 4 null null Example Output: 3 2

Key concepts

treesdepthleaves

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.