youngyangyang04 / leetcode-master-comment

用来做评论区
0 stars 0 forks source link

[Vssue]0226.翻转二叉树.md #78

Open youngyangyang04 opened 6 months ago

youngyangyang04 commented 6 months ago

https://www.programmercarl.com/0226.%E7%BF%BB%E8%BD%AC%E4%BA%8C%E5%8F%89%E6%A0%91.html

Du1in9 commented 5 months ago
class Solution {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) return root;
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;

        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
djsjznsn commented 2 months ago

我太笨了,还是没搞懂为什么不能中序操作》。。。

yinshi197 commented 3 weeks ago

打卡