赞
踩
解题思路:
- class Solution {
- public TreeNode invertTree(TreeNode root) {
- if (root == null) return null;
-
- TreeNode left = invertTree(root.left);
- TreeNode right = invertTree(root.right);
- root.left = right;
- root.right = left;
- return root;
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。