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; } } };
leetcode114
猜你喜欢
转载自www.cnblogs.com/asenyang/p/9780149.html
今日推荐
周排行