2 different simple recursion O(n) time beats 100%
The first solution\'s idea is only on about the fact that root.right.next = root.next.left\n\nclass Solution:\n    def connect(self, root: \'Node\') -> \'Node\'
The first solution\'s idea is only on about the fact that `root.right.next = root.next.left`\n```\nclass Solution:\n    def connect(self, root: \'Node\') -> \'Node\':\n        if not root or not root.left:\n            return root\n        root.left.next = root.right\n        if root.next:\n            root.right.next = root.next.left\n        self.connect(root.left)\n        self.connect(root.right)\n        return root\n```\n\nThe 2nd solution is as simple as stiching nodes recursively, 3 pairs at a time\n```\nclass Solution:\n    def connect(self, root: \'Node\') -> \'Node\':\n        if not root or not root.left:\n            return root\n        def stich(left, right):\n            if not left:\n                return\n            if left.next:\n                # optimize, save huge time\n                return\n            left.next = right\n            stich(left.left, left.right)\n            stich(left.right, right.left)\n            stich(right.left, right.right)\n        stich(root.left, root.right)\n        return root\n```
['Recursion', 'Python']