Skip to content

Commit a29b52c

Browse files
Merge pull request youngyangyang04#1445 from Gyangle/111_typo_fix
更新 111.二叉树的最小深度 的拼写错误及改进规范
2 parents 1b206a7 + 6d804e2 commit a29b52c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

problems/0102.二叉树的层序遍历.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,21 +2629,21 @@ JavaScript:
26292629
var minDepth = function(root) {
26302630
if (root === null) return 0;
26312631
let queue = [root];
2632-
let deepth = 0;
2632+
let depth = 0;
26332633
while (queue.length) {
26342634
let n = queue.length;
2635-
deepth++;
2635+
depth++;
26362636
for (let i=0; i<n; i++) {
26372637
let node = queue.shift();
2638-
// 如果左右节点都是null,则该节点深度最小
2638+
// 如果左右节点都是null(在遇见的第一个leaf节点上),则该节点深度最小
26392639
if (node.left === null && node.right === null) {
2640-
return deepth;
2640+
return depth;
26412641
}
26422642
node.left && queue.push(node.left);;
2643-
node.right && queue.push (node.right);
2643+
node.right && queue.push(node.right);
26442644
}
26452645
}
2646-
return deepth;
2646+
return depth;
26472647
};
26482648
```
26492649

0 commit comments

Comments
 (0)