# 217. Contains Duplicate PonPon === ``` c= int cmp(const void *a, const void *b){ return *(int*)a-*(int*)b; } bool containsDuplicate(int* nums, int numsSize){ int i=0, j=0; if (numsSize == 1) return false; qsort(nums, numsSize, sizeof(int), cmp); for (i=0;i<numsSize-1;i++) { if (nums[i] == nums[i+1]) return true; } return false; } time complexity: O(n log n) space complexity: O(1) Comment: Search qsort in web, need to implement merge sort ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up