mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-06 14:27:26 +08:00
Update source codes.
This commit is contained in:
@ -41,7 +41,7 @@ namespace hello_algo.chapter_array_and_linkedlist
|
||||
public static void Insert(int[] nums, int num, int index)
|
||||
{
|
||||
// 把索引 index 以及之后的所有元素向后移动一位
|
||||
for (int i = nums.Length - 1; i >= index; i--)
|
||||
for (int i = nums.Length - 1; i > index; i--)
|
||||
{
|
||||
nums[i] = nums[i - 1];
|
||||
}
|
||||
|
Reference in New Issue
Block a user