Populating Next Right Pointers in Each NodePopulating Next Right Pointers in Each Node IIQuestion1You are given aperfect binary treewhere all leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node {
int val;
Node *left;
Node *right;
Node *next;
}Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL.Initially, all next pointers are set toNULL.Example 1:Input: root = [1,2,3,4,5,6,7]
Output: [1,#,2,3,#,4,5,6,7,#]
Explanation: Given the above perfec
...
继续阅读
(52)