反转二叉树
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;}
};
反转二叉树
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;}
};