@@ -0,0 +1,589 @@
+%0D%0Apublic class _116PopulatingNextRightPointersInEachNode %7B%0D%0A    public void connect(TreeLinkNode root) %7B%0D%0A    %09if (root == null) return;%0D%0A    %09TreeLinkNode pre = root;%0D%0A    %09TreeLinkNode cur = null;%0D%0A    %09while (pre.left != null) %7B%0D%0A    %09%09cur = pre;%0D%0A    %09%09while (cur != null) %7B%0D%0A    %09%09%09cur.left.next = cur.right;%0D%0A    %09%09%09if (cur.next != null) cur.right.next = cur.next.left;%0D%0A    %09%09%09cur = cur.next;%0D%0A    %09%09%7D%0D%0A    %09%09pre = pre.left;%0D%0A    %09%7D%0D%0A    %7D%0D%0A    %0D%0A    public class TreeLinkNode %7B%0D%0A    %09int val;%0D%0A    %09TreeLinkNode left, right, next;%0D%0A    %09TreeLinkNode(int x) %7B val = x; %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Add 116 solution