VISUALGO//PROBLEMS
maximum depth of binary tree · binary tree – dfseasy
LeetCode #104
tree
3920157
depth
·
max
·
ELEMENTS
root
Python
def maxDepth(root: TreeNode | None) -> int:
    if root is None:
        return 0
    return 1 + max(maxDepth(root.left), maxDepth(root.right))