mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 12:36:30 +08:00
Compare commits
1 commit
ed6f3c6b20
...
f33b254f79
Author | SHA1 | Date | |
---|---|---|---|
|
f33b254f79 |
1 changed files with 1 additions and 1 deletions
|
@ -70,7 +70,7 @@ class MyList {
|
|||
remove(index) {
|
||||
if (index < 0 || index >= this.#size) throw new Error('索引越界');
|
||||
let num = this.#arr[index];
|
||||
// 将索引 index 之后的元素都向前移动一位
|
||||
// 将将索引 index 之后的元素都向前移动一位
|
||||
for (let j = index; j < this.#size - 1; j++) {
|
||||
this.#arr[j] = this.#arr[j + 1];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue