MCPcopy 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 */
7var rightSideView = function (root) {
8 const isBaseCase = root === null;
9 if (isBaseCase) return [];
10
11 return bfs([root]);
12};
13
14const bfs = (queue, rightSide = []) => {
15 while (queue.length) {

Callers 1

dfsFunction · 0.70

Calls 3

bfsFunction · 0.70
dfsFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected