You are given the root of a binary tree.
Imagine standing on the right side of the tree.
Return the values of the nodes you can see from top to bottom.
Input: root = [5,3,8,1,4,null,9]
Output: [5,8,9]
Explanation:
From the right side, you see 5 → 8 → 9.
Input: root = [7,2,10,1,null,8,12]
Output: [7,10,12]
Explanation:
Right side view shows 7 → 10 → 12.
Input: root = [1,null,2,null,3]
Output: Only right children are visible.
Input: root = []
Output: []
Explanation:
Empty tree, nothing to see.
Accepted:
Submission: