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