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
出处 LeetCode 算法第94题 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2]
出处 LeetCode 算法第94题
给定一个二叉树,返回它的中序 遍历。
示例:
输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2]
简单,递归即可
/** * Definition for a binary tree node. * function TreeNode(val) { * this.val = val; * this.left = this.right = null; * } */ /** * @param {TreeNode} root * @return {number[]} */ var inorderTraversal = function(root) { var result = []; if (root == null) { return result; } return result.concat(inorderTraversal(root.left), root.val, inorderTraversal(root.right)); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
习题
思路
简单,递归即可
解答
The text was updated successfully, but these errors were encountered: