Maximum Depth of Binary Tree

LeetCode: https://leetcode.com/problems/maximum-depth-of-binary-tree/

Given the root of a binary tree, return its maximum depth.

1def maxDepth(root: Optional[TreeNode]) -> int:
2 if not root:
3 return 0
4 return 1 + max(maxDepth(root.left), maxDepth(root.right))
node
3
0
9
1
20
2
3
4
15
5
7
6
tree=Array(7)
Step 1 / 7
Step 1:
Start DFS at root=3. Depth is 1 + max(depth(left), depth(right)).
Pointers: node=0
Focus: select @ [0]