Given the root of a binary tree, connect each node to its next right neighbor on the same level (the last node of each level points to nothing). Return, in level-order, the value of each node's next pointer (or -1 if it has none). The tree is given as a level-order array.
Input: A level-order array of the tree.
Output: Array — each node's next value (or -1), in level order.
Input: [1,2,3,4,5,null,7]
Output: [-1,3,-1,5,7,-1]
Explanation: Each node points to its right neighbor.Input: [1]
Output: [-1]
Explanation: Root has no neighbor.Input: []
Output: []
Explanation: Empty tree.0<=nodes<=10^4-1000<=value<=1000values unique per level