```
class Solution {
public:
TreeNode* upsideDownBinaryTree(TreeNode* root) {
if(!root || !root->left) return root;
TreeNode *new_tree = upsideDownBinaryTree(root->left);
root->left->left = upsideDownBinaryTree(root->right);
root->left->right = root;
root->left = root->right = NULL;
return new_tree;
}
};
```