S
All challenges
Practice
Home
Blog
Practice
Examples
Feedback
Height of Binary Tree
00:00
Start
00:00
Sign in
Problem
Hints
3
Solution
History
Easy
Tree
DFS
BFS
Recursion
TCS
Infosys
Wipro
Find the maximum depth of a binary tree — longest path from root to farthest leaf.
Examples
Example 1
Input →
[3,9,20,null,null,15,7]
Output →
3
Example 2
Input →
[1,null,2]
Output →
2
Example 3
Input →
[]
Output →
0
Example 4
Input →
[1]
Output →
1
JavaScript
Python
Java (Coming soon)
C (Coming soon)
C++ (Coming soon)
Reset
Run
Submit
Cases
Results