226. 翻转二叉树
题目

解题思路
非常简单的题目。用一个中间变量保存一下root.left就行。相当于交换两个数。
代码
class Solution {
    public TreeNode invertTree(TreeNode root) {
        if(root==null){
            return null;
        }
            TreeNode oldleft=root.left;
            root.left=root.right;
            root.right=oldleft;
            invertTree(root.left);
            invertTree(root.right);
            return root;
    }
}
 
                     
                     
                        
                        