Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
For the best coding experience, use a desktop browser.
Easy
Tree
Maximum Depth of Binary Tree
Return maximum depth of a binary tree.
Examples
Input:
root = [3,9,20,null,null,15,7]
Output:
3
Sample Test Cases
Case 1 Input:
[3,9,20,null,null,15,7]
Expected:
3
Case 2 Input:
[1,null,2]
Expected:
2
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
[3,9,20,null,null,15,7]
Expected:
3
Case 2 Input:
[1,null,2]
Expected:
2