🔥 C++:  O(1) space,  O(n) time, 7 lines solution 🔥
\n/*\n// Definition for a Node.\nclass Node {\npublic:\n    int val;\n    Node* left;\n    Node* right;\n    Node* next;\n\n    Node() : val(0), left(NULL), rig
```\n/*\n// Definition for a Node.\nclass Node {\npublic:\n    int val;\n    Node* left;\n    Node* right;\n    Node* next;\n\n    Node() : val(0), left(NULL), right(NULL), next(NULL) {}\n\n    Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}\n\n    Node(int _val, Node* _left, Node* _right, Node* _next)\n        : val(_val), left(_left), right(_right), next(_next) {}\n};\n*/\n\nclass Solution {\npublic:\n    Node* connect(Node* root) {\n        if(root && root->left != NULL) {\n            root->left->next = root->right;\n            connect(root->left);\n            if(root->next != NULL) root->right->next = root->next->left;\n            connect(root->right);\n        }\n        \n        return root;\n    }\n};\n```
['Recursion', 'C', 'C++']