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? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
提一个三序遍历的递归解法:
var preorderTraversal = function(root, arr = []) { if (root) { arr.push(root.val); preorderTraversal(root.left, arr); preorderTraversal(root.right, arr); } return arr; };
中序和后序把上面if里面的三行代码调换顺序即可。 思路是一样的,借用JS的特性变得更精简一些。
Sorry, something went wrong.
No branches or pull requests
各位大佬有什么更多、更好的解法可以提出,并收录进去,就成了大家的知识宝库、面试宝典,谢谢大家的支持哇♥️ ♥️ ♥️
The text was updated successfully, but these errors were encountered: