标签:null ptr roo tree flat div nbsp treenode while
class Solution { public: void flatten(TreeNode* root) { while(root){ if(root->left){ TreeNode* pre=root->left; while(pre->right){ pre=pre->right; } pre->right=root->right; root->right=root->left; root->left=nullptr; } root=root->right; } } };
标签:null ptr roo tree flat div nbsp treenode while
原文地址:https://www.cnblogs.com/asenyang/p/9780149.html