20%off off — LaunchSpecial
Exercises/#31 Maximum Depth of Binary Tree
#31

Maximum Depth of Binary Tree

Easy🌳 Trees
40 XP

Problem

Given the root of a binary tree, return its maximum depth (number of nodes along the longest path from root to leaf).

Examples

Input: [3,9,20,null,null,15,7]
Output: 3

Input: [1,null,2]
Output: 2
treedfsrecursion
AI Assistant— powered by AI

Unlock hints progressively — start gentle, go deeper only if needed.

💡

Level 1: Gentle Nudge

A subtle direction

🗺️

Level 2: Approach

The algorithm to use

🔍

Level 3: Detailed

Step-by-step guidance

31 / 150

Your Solution

⚡ JavaScript

to save progress and use AI features