要弄懂final关键字的含义
此题不加也行
class Solution { public TreeNode invertTree(TreeNode root) { if(root==null) return null; final TreeNode left=root.left, right=root.right; root.left=invertTree(right); root.right=invertTree(left);
return root; } }
要弄懂final关键字的含义
此题不加也行
class Solution { public TreeNode invertTree(TreeNode root) { if(root==null) return null; final TreeNode left=root.left, right=root.right; root.left=invertTree(right); root.right=invertTree(left);
return root; } }