Question bank › Trees
Dsa Trees Warm-up

Max Tree Depth

You need to find the maximum depth of a binary tree from the root to the furthest leaf node. The depth of a node is the number of edges from the node to the tree's root node. Input Format: - The input consists of lines representing the binary tree in level-order where each line contains either an integer (node value) or 'null' (indicating the absence of a node). The input ends when there are no more lines. Output Format: - Output should be a single integer representing the maximum depth of the tree. Example: Input: 1 2 null 3 null null null Output: 3

Key concepts

treesdepthrecursion

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