class Solution {
public:
TreeNode* invertTree(TreeNode* root) {
if(root==NULL) return NULL;
TreeNode *left=invertTree(root->left);
TreeNode *right=invertTree(root->right);
root->left=right;
root->right=left;
return root;
}
};
翻转二叉树
最新推荐文章于 2024-11-05 21:58:11 发布