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;
}
二叉树的中序遍历
最新推荐文章于 2025-07-22 15:31:58 发布