Maximum Depth of Binary Tree
Easy
Trees
Tree
BFS
DFS
Given a tree as level-order array, find its maximum depth.
Constraints
Nodes ≤ 10^4
Examples
Example 1:
Input: 3 9 20 null null 15 7
Output: 3
Example 2:
Input: 1 null 2
Output: 2
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console