当前位置: 代码迷 >> 综合 >> leetcode 226. Invert Binary Tree (easy)
  详细解决方案

leetcode 226. Invert Binary Tree (easy)

热度:45   发布时间:2024-01-05 00:40:35.0

反转二叉树

class Solution
{public:TreeNode *invertTree(TreeNode *root){if (root){root->left = invertTree(root->left);root->right = invertTree(root->right);swap(root->left, root->right);}return root;}
};
  相关解决方案