116. Populating Next Right Pointers in Each Node
public class Solution { public void connect(TreeLinkNode root) { TreeLinkNode startNode=root; while(startNode!=null) { TreeLinkNode node=startNode; while(node!=null) { if(node.left!=null) node.left.next=node.right; if(node.right!=null&&node.next!=null) node.right.next=node.next.left; node=node.next; } startNode=startNode.left; } } }