LeetCode – Populating Next Right Pointers in Each Node II (Java)
Follow up for problem “Populating Next Right Pointers in Each Node“. What if the given tree could be any binary tree? Would your previous solution still work? Analysis Similar to Populating Next Right Pointers in Each Node, we have 4 pointers at 2 levels of the tree. Java Solution public void connect(TreeLinkNode root) { if(root … Read more