Imagine you stand on the right side of a binary tree and look at it. You can see the right-most node on each level. Collect the values of the nodes that are visible to you, from the top level down to the bottom level.
If the right branch is shorter than the left branch, you also see nodes of the left branch on the deeper levels.
How the judge passes the data
Examples
Example 1:
Input: root = [1,2,3,4,null,null,5]
Output: [1,3,5]
Explanation: Level by level you see 1, then 3, then 5.
Example 2:
Input: root = [6,4,null,3,5]
Output: [6,4,5]
Explanation: The root has only a left child. On the last level the right-most node is 5.
Example 3:
Input: root = [9]
Output: [9]
Explanation: A tree with one node shows only that node.