forked from youngyangyang04/leetcode-master
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit bcdf3e4
Update 0347.前K个高频元素.md
1. 修复了 JavaScript 解法二,堆 pop 方法无法处理数组长度 <= 1 的边界情况的问题
2. 删除了有误导性的条件判断。事实上,被删除的表达式永远为真(searchChild !== undefined)。原作者想表达的意思可能是 this.queue[searchChild] !== undefined,而实际上,这个判断也是不必要的,这种情况会被后续的 this.compare(index, searchChild) > 0 判断排除。但鉴于本项目的教程性质,直接去除可能会导致语义不清,考虑酌情将原处替换为 this.queue[searchChild] !== undefined 或直接删除1 parent 1c390b3 commit bcdf3e4
1 file changed
+1
-1
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
421 | 421 |
| |
422 | 422 |
| |
423 | 423 |
| |
424 | - | ||
424 | + | ||
425 | 425 |
| |
426 | 426 |
| |
427 | 427 |
| |
|
0 commit comments