标签:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public TreeNode invertTree(TreeNode root) { if(root==null) return null; TreeNode temp=root; TreeNode t=null; t=temp.left; temp.left=temp.right; temp.right=t; invertTree(temp.left); invertTree(temp.right); return temp; } }
标签:
原文地址:http://www.cnblogs.com/aguai1992/p/5347239.html