[leetcode] 226. Invert Binary Tree 解题报告

要弄懂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; } }

猜你喜欢

转载自www.cnblogs.com/pulusite/p/9657603.html