Python accepted code
def connect(self, root):\n        if not root: return\n        while root.left:\n            cur = root.left\n            prev = None\n            while root:\n
    def connect(self, root):\n        if not root: return\n        while root.left:\n            cur = root.left\n            prev = None\n            while root:\n                if prev: prev.next = root.left\n                root.left.next = root.right\n                prev = root.right\n                root = root.next\n            root = cur
[]