题目很直接,很简单啊
TreeNode* Mirror(TreeNode* pRoot) { // write code here if(pRoot == NULL){ return NULL; } TreeNode* left = Mirror(pRoot->left); TreeNode* right = Mirror(pRoot->right); pRoot->left = right; pRoot->right = left; return pRoot; }
TreeNode* Mirror(TreeNode* pRoot) { // write code here if(pRoot == NULL){ return NULL; } TreeNode* left = Mirror(pRoot->left); TreeNode* right = Mirror(pRoot->right); pRoot->left = right; pRoot->right = left; return pRoot; }