mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
Merge pull request #782 from Jerry-306/patch-15
修改 0107 二叉树层序遍历II JavaScript解法
This commit is contained in:
@ -421,9 +421,10 @@ var levelOrderBottom = function(root) {
|
||||
node.left&&queue.push(node.left);
|
||||
node.right&&queue.push(node.right);
|
||||
}
|
||||
res.push(curLevel);
|
||||
// 从数组前头插入值,避免最后反转数组,减少运算时间
|
||||
res.unshift(curLevel);
|
||||
}
|
||||
return res.reverse();
|
||||
return res;
|
||||
};
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user