mirror of
https://github.com/TheAlgorithms/C
synced 2025-05-18 09:58:04 +03:00
14 lines
310 B
C
14 lines
310 B
C
int numcmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
|
|
|
|
bool containsDuplicate(int *nums, int numsSize)
|
|
{
|
|
int i;
|
|
qsort(nums, numsSize, sizeof(int), numcmp);
|
|
for (i = 0; i < numsSize - 1; i++)
|
|
{
|
|
if (nums[i] == nums[i + 1])
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|