mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
13 lines
257 B
C
13 lines
257 B
C
int removeDuplicates(int *nums, int numsSize)
|
|
{
|
|
int count = 0, i;
|
|
for (i = 1; i < numsSize; i++)
|
|
{
|
|
if (nums[i] == nums[i - 1])
|
|
count++;
|
|
else
|
|
nums[i - count] = nums[i];
|
|
}
|
|
return numsSize - count;
|
|
}
|