```
public class Solution {
public int maxDepth(TreeNode root) {
if (root == null) return 0;
// if (root.right == null) return 1 + maxDepth(root.left);
// if (root.left == null) return 1 + maxDepth(root.right);
return 1 + Math.max(maxDepth(root.left), maxDepth(root.right)); //isLeaf is checked here
}
}
```

If the root is null return 0;

If the root is not null return the max of

1 + the max depth of the left and

1 + the max depth of the right