93. Right Side View of a Binary Tree
MediumTrees
Imagine standing to the right of a binary tree. Return the values you can see, from the top level to the bottom: the rightmost node of each level.
A binary tree is passed as TreeNode objects with val, left and right. The tests write trees in level order, with null for a missing child.
Example 1
Input: root = [1, 2, 3, null, 5, null, 4] Output: [1, 3, 4]
Constraints
0 ≤ nodes ≤ 100