Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/neetcode-gh/leetcode
/ rightSideView
Function
rightSideView
javascript/0199-binary-tree-right-side-view.js:7–12 ·
view source on GitHub ↗
(root)
Source
from the content-addressed store, hash-verified
5
* @
return
{number[]}
6
*/
7
var
rightSideView =
function
(root) {
8
const
isBaseCase = root === null;
9
if
(isBaseCase)
return
[];
10
11
return
bfs([root]);
12
};
13
14
const
bfs = (queue, rightSide = []) => {
15
while
(queue.length) {
Callers
1
dfs
Function · 0.70
Calls
3
bfs
Function · 0.70
dfs
Function · 0.70
push
Method · 0.45
Tested by
no test coverage detected