C++ || O(n) time || O(1) space || No recursion space || 0ms || faster than 100%
The idea is to fix the next pointer for child nodes while traversing through parent node. \nOnce you fixed the next pointer then you can traverse this level in 
The idea is to fix the next pointer for child nodes while traversing through parent node. \nOnce you fixed the next pointer then you can traverse this level in O(1) space.\n```\nclass Solution {\npublic:\n    Node* connect(Node* root) {\n       if(!root)return root;\n       Node* curr=root;\n       while(curr->left){\n            Node* currLeft=curr->left;\n            while(curr){\n                curr->left->next=curr->right;\n                curr->right->next=curr->next?curr->next->left:NULL;\n                curr=curr->next;\n            }\n            curr=currLeft;\n       }\n       return root;\n    }\n};\n```\nFeel free to ask doubt in comments and please don\'t forget to upvote if you like the solution.
[]