26. Maximum Depth
Easy
Given the root of a binary tree, return the number of nodes along the longest path from the root to a leaf. An empty tree has depth zero.
Example 1
Input: raiz = [8, 3, 10, 1, 6]
Output: 3
Example 2
Input: raiz = []
Output: 0
Constraints
- 0 <= quantidade de nós <= 10^4
- -10^5 <= valor dos nós <= 10^5
TreesDFS
Saved in this browser
Caso 1
raiz =
[8,3,10,1,6]
Expected =
3
Caso 2
raiz =
[]
Expected =
0
Run checks these 2 cases. Submit runs all 6, including hidden ones.