Update source codes.

This commit is contained in:
Yudong Jin
2022-12-20 13:20:20 +08:00
parent 030042e689
commit a8fb1a4f41
7 changed files with 7 additions and 7 deletions

View File

@ -30,7 +30,7 @@ function extend(nums: number[], enlarge: number): number[] {
/* 在数组的索引 index 处插入元素 num */
function insert(nums: number[], num: number, index: number): void {
// 把索引 index 以及之后的所有元素向后移动一位
for (let i = nums.length - 1; i >= index; i--) {
for (let i = nums.length - 1; i > index; i--) {
nums[i] = nums[i - 1];
}
// 将 num 赋给 index 处元素