class Solution { public: TreeNode* invertTree(TreeNode* root) { if(root == NULL) return NULL; TreeNode* tmp = invertTree(root->left); root->left = invertTree(root->right); root->right = tmp; return root; } };
leetcode 226. Invert Binary Tree
原文:https://www.cnblogs.com/ymjyqsx/p/9662525.html