I'm am doing some problems on leetcode and came across the following problem:

```
Invert a binary tree:

     4
   /   \
  2     7
 / \   / \
1   3 6   9

to
     4
   /   \
  7     2
 / \   / \
9   6 3   1

```

I have the solution but wouldn't my code work with just the first return statement? Wouldn't the first statement serve as the base case and be enough? Why does the last return statement have to be there?

```
public TreeNode invertTree(TreeNode root) {
    if(root == null) {
        return root;
    }
    TreeNode temp = root.left;
    root.left = root.right;
    root.right = temp;

    invertTree(root.left);
    invertTree(root.right);

    return root;
}

```