← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Binary Tree Right Side View is LeetCode problem #199, frequently asked in Meta (Facebook) interviews with tags Tree, BFS, DFS, and Binary Tree.[1][8]
Given the root of a binary tree, imagine you are standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.[2][7][8][1]
Example 1:
Input: root = [1,2,3,null,5,null,4] Output: [1,3,4]
Explanation: From the right side, nodes 1, 3, and 4 are visible.[5][2]
Example 2:
Input: root = [1,null,3] Output: [1,3]
Explanation: Nodes 1 and 3 form the right side view.[5]
Example 3:
Input: root = [] Output: []
Explanation: Empty tree returns empty list.[5]