117. Populating Next Right Pointers in Each Node II
题目大意
Populate each next
pointer to point to its next right node. If there is no next right node, the next
pointer should be set to NULL.
Initially, all next
pointers are set to NULL.
中文释义
填充每个节点的 next
指针,使其指向其右侧的下一个节点。如果没有右侧的下一个节点,则将 next
指针设置为 NULL。
初始时,所有 next
指针都设置为 NULL。
示例
示例 1:
输入: root
= [1,2,3,4,5,null,7]
输出: [1,#,2,3,#,4,5,7,#]
Example 2:
Input: root = []
Output: []