var inorderTraversal = function(root) {
const arr = [];
const inOrder = (root) => {
if(!root) return;
inOrder(root.left);
arr.push(root.val);
inOrder(root.right);
}
inOrder(root);
return arr;
}
二叉树的中序遍历
最新推荐文章于 2024-07-15 22:57:43 发布