Back to DSA
Maximum Depth of Binary Tree
easyGiven the root of a binary tree, compute its maximum depth. The maximum depth is the number of nodes on the longest path from the root down to the most distant leaf.
Examples
Example 1:
Input:
root = [5,3,8,1,4,null,10]Output:
3 Example 2:
Input:
root = [2,null,7]Output:
2Hints
1234567