C++ || Constant Space || Iterative + Recursive
Iteraitve Solution \n\n\nclass Solution {\npublic:\n    Node* connect(Node* root) {\n        if(!root || !root->left) return root;\n        Node *current = root
Iteraitve Solution \n\n```\nclass Solution {\npublic:\n    Node* connect(Node* root) {\n        if(!root || !root->left) return root;\n        Node *current = root;\n        while(current->left) {\n            Node *temp = current;\n            while(current) {\n                current->left->next = current->right;\n                if(current->next) current->right->next = current->next->left;\n                current = current->next;\n            }\n            current = temp->left;\n        }\n        return root;\n    }\n};\n```\n\nRecursive Solution \n\n```\nclass Solution {\npublic:\n    Node* connect(Node* root) {\n        if(!root || !root->left) return root;\n        root->left->next = root->right;\n        if(root->next) root->right->next = root->next->left;\n        connect(root->left);\n        connect(root->right);\n        return root;\n    }\n};\n```
['C', 'C++']