5 Lines Recursive Python Solution🔥🔥🔥
\n\nclass Solution:\n    def connect(self, root: \'Node\', next=None) -> \'Node\':\n        if root is None: return None\n        root.next = next\n        self
\n```\nclass Solution:\n    def connect(self, root: \'Node\', next=None) -> \'Node\':\n        if root is None: return None\n        root.next = next\n        self.connect(root.left, root.right)\n        self.connect(root.right, root.next.left if root.next else None)\n        return root\n```
['Tree', 'Depth-First Search', 'Recursion', 'Python']