We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
When a tree is given and you are standing right side of tree. Return values from top to bottom.
Using DFS with level, value of level is overwritten by right most value.
const rightSideView = function(root) { const res = []; function walk(node, level=0) { if(!node) return; res[level] = node.val; walk(node.left, level+1); walk(node.right, level+1); } walk(root); return res; };
The text was updated successfully, but these errors were encountered:
kokocan12
No branches or pull requests
Problem
When a tree is given and you are standing right side of tree.
Return values from top to bottom.
Approach
Using DFS with level, value of level is overwritten by right most value.
The text was updated successfully, but these errors were encountered: