C# while
\npublic class Solution {\n    public Node Connect(Node root) {\n        var preMostLeft = root;\n        while (preMostLeft != null) {\n            var cur = p
```\npublic class Solution {\n    public Node Connect(Node root) {\n        var preMostLeft = root;\n        while (preMostLeft != null) {\n            var cur = preMostLeft;\n            while (cur != null && cur.left != null) {\n                cur.left.next = cur.right;\n                if (cur.next != null) {\n                    cur.right.next = cur.next.left;\n                }\n                cur = cur.next;\n            }\n\n            preMostLeft = preMostLeft.left;\n        }\n\n        return root;\n    }\n}\n```
[]