Company: Applogic networks_Software engineer intern_Oncampus_21july
Difficulty: easy
Given the root of a binary tree, return the level-order traversal of its nodes’ values, right to left , level by level. That is, print the nodes of depth 0 first, then depth 1, and so on; and within each level print the nodes from the rightmost to the leftmost. Input Format The tree is supplied in the usual compact level-order form: The first line contains an integer M , the number of tokens describing the tree. The second line contains M whitespace-separated tokens. Each token is either an integer (a node value) or the literal null (an absent child). The tokens list the tree in level order, where the two tokens following a present node are its left child and its right child. Trailing null tokens are omitted. A tree consisting of the single token null is the empty tree. Output Format Print one line per level, starting from the root’s level. Each line contains that level’s node values from right to left, separated by single spaces. If the tree is empty, print nothing.