Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- knakul853
- */
- class Solution {
- public:
- TreeNode* pre = NULL;
- void flatten(TreeNode* root) {
- if( !root ) return ;
- flatten( root->right );
- flatten( root->left );
- root->left = NULL;
- root->right = pre;
- pre = root;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment