var rightSideView = function (root) {const list = []// dfs的顺序为 根节点 -> 右子节点 -> 左子节点const dfs = (node, count) => {if (!node) return// 如果是当前层的第一个访问的说明是该层的最右节点if(count === list.length) {list.push(node.val)}count++dfs(node.right, count)dfs(node.left, count)}dfs(root, 0)return list};
